Anda di halaman 1dari 12

BCA MCA BA MA BDP B.COM M.COM B.

SC
http://www.ignouassignmentguru.com

O U T
G N E N
I NM
S I G U
A S U R
G 1
IGNOU ASSIGNMENT GURU Page-

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

O U T
G N E N
I NM
S I G U
A S U R
G 2
IGNOU ASSIGNMENT GURU Page-

Part -I : MCS - 041

Q.1.
/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

A.1.
a) The Unix passwd command
The standard Unix command to change your password is:

passwd
You must know your current password.
To change your password while logged onto a UNIX
machine, type:passwd

passwd

O U
To see the possible command line options, type: man

T
E N
If no options are given, actions are as follows:

N
The name that the user logged in as is determined.

G
I NM
If an entry for the user exists in the NIS (Network
Information Service) passwd database, the password field
in that entry is changed.

S I G
b) grep [OPTIONS] PATTERN [FILE...]

U
The pattern matching done by grep command is case

A U R
sensitive. For example, if the argument to grep command

S
is "LINUX" (instead of "Linux") then grep will not match
the lines containing string "Linux".

G
Here is an example :
# grep "LINUX" input.txt
#
3
IGNOU ASSIGNMENT GURU Page-

c) head -lines filename


In this example, lines is an optional value specifying the
number of lines to be read. If you don't give a number, the
default value of 10 is used. Also, filename represents the
name of an optional file for the head command to read.
/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

Otherwise, it will take its input from stdin (standard input:


the terminal, or whatever the shell feeds the process with,
usually pipe output).

For example, given a file containing the English alphabet


with each letter on a separate line, a user enters the
command:

U
head -3 alphabetfile

T
This command would return:

O
a
b

G N E N
c

I NM
You can also use the head command with pipes. For
example, to see the sizes of the first few files in a large

S I G
directory, you could enter at the Unix prompt:

U
R
ls -l | head

A S U
d) To view only the processes owned by a specific user,

G
use the following command:

top -U [username]
Replace the [username] with the required username
4
IGNOU ASSIGNMENT GURU Page-

If you want to use ps then

ps -u [username]
OR

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

ps -ef | grep <username>


OR

ps -efl | grep <username>

e) kill PID
Replace PID with the process ID of the job. If that fails,
enter the following:

U
kill -KILL PID

O T
To determine a job's PID, enter:

N
jobs -l

G E N
I NM
f)$ wc -l file.txt
1020 file.txt

G
g)sort sorts the contents of a text file, line by line.

I U
sort [options] filename

S
A S R
The options are:

U
G
-b : Ignores leading spaces in each line
-d : Uses dictionary sort order. Conisders only spaces and
alphanumeric characters in sorting
-f : Uses case insensitive sorting.
-M : Sorts based on months. Considers only first 3 letters
5
IGNOU ASSIGNMENT GURU Page-

as month. Eg: JAN, FEB


-n : Uses numeric sorting
-R : Sorts the input file randomly.
-r : Reverse order sorting
-k : Sorts file based on the data in the specified field
/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

positions.
-u : Suppresses duplicate lines
-t : input field separator

h) $ echo qWeRtY | sed -E


's/([[:lower:]])|([[:upper:]])/\U\1\L\2/g'
QwErTy

U
i)

N O N T
G
I NM E
G
j)

S I
Display a conveniently-formatted calendar from the
command line.

R U
S
cal [options] [[[day] month] year]

A
Options

-1
G U
Display a single month, which is the default setting.
-3
6
IGNOU ASSIGNMENT GURU Page-

Display three months: last month, this month, and next


month.
-s
Display the calendar using Sunday as the first day of the
week.
-m

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

Display Monday as the first day of the week.


-j
Display dates of the Julian calendar.
-y
Display a calendar for the entire current year.
cal examples

cal

U
Displays the calendar for this month.
cal 12 2000

O T
G N E N Shell Programming:-
1)
I NM
read -p "Enter first Number:" n1
read -p "Enter second Number:" n2

S I G
read -p "Enter third Number:" n3

U
read -p "Enter fourth Number:" n4

A S U R
read -p "Enter fourth Number:" n5
if[ [ n1 -gt n2 ] && [ n1 -gt n2 ] && [ n1 -gt n3 ] && [ n1 -gt
n4 ] && [ n1 -gt n5 ]] ; then

G
echo "$n1 is a Greatest Number"
elif[ [ n2 -gt n3 ] && [ n2 -gt n3 ] && [ n2 -gt n4 ] && [ n2 -
gt n5 ]] ; then
echo "$n2 is a Greatest Number"
7
IGNOU ASSIGNMENT GURU Page-

elif[ [ n3 -gt n4 ] && [ n3 -gt n5 ] ] ; then


echo "$n3 is a Greatest Number"
elif[ n4 -gt n5 ] ; then
echo "$n4 is a Greatest Number"
else
echo "$n5 is a Greatest Number"
/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

fi

2)
echo Enter a 7 digit number
read num
n=1
while [ $n -le 7 ]
do

echo $a

O U
a=`echo $num | cut -c $n`

n=`expr $n + 2`
T
done

G N E N
3)

I NM
clear
echo "Entre a string to find the number of Vowels "
read st

I G U
len=`expr $st | wc -c`

S R
len=`expr $len - 1`

A S
count=0

U
while [ $len -gt 0 ]
do

G
ch=`expr $st | cut -c $len`
case $ch in

[aeiou,AEIOU]) count=`expr $count + 1` ;;


8
IGNOU ASSIGNMENT GURU Page-

esac
len=`expr $len - 1`
done
echo "Number of vowels in the give string is $count"

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

OutPut

Entre a string to find the number of Vowels


AbcefuSI
Number of vowels in the give string is 4

4) #!/bin/bash
echo Enter first string:
read s1

U T
echo Enter second string:
read s2
O
G N
s3=$s1$s2

E N
len=`echo $s3 | wc -c`

I NM
len=`expr $len - 1`
echo Concatenated string is $s3 of length $len

5)

I G U
echo "Enter a Number:"

S R
read a

A S
rev=0
sd=0
U
or=$a
G
while [ $a -gt 0 ]
do
9
IGNOU ASSIGNMENT GURU Page-

sd=`expr $a % 10`
temp=`expr $rev \* 10`
rev=`expr $temp + $sd`
a=`expr $a / 10`
done

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com

echo "Reverse of $or is $rev"

Part -II : MCS - 043


A.1.(a)
MCA_Evaluation_System

U
create table Rent

T
(

O
aptid int primary key,

N
rentsetdate date primary key notnull,

N
rentpermonth int

E
);

G
I NM
create table Renter

G
renterID int foreign key notnull ,

I
name varchar(20) notnull,

U
contact varchar(50) notnull
);

S S U R
A
create table Rental

G
(
aptID int foreign key notnull , 10
renterID int foreign key notnull,
startdate date notnull,
IGNOU ASSIGNMENT GURU Page-

enddate date notnull,

checkout varchar(2)
);

create Apartment(aptID, city, street, housenr, aptnr, size, purchdate, price).


(

aptID int foreign key notnull ,


city varchar(50) notnull,
street varchar(20) notnull,

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com
housenr int notnull,

aptnr int notnull,

size int notnull,

purchdate date notnull,

price int notnull

);

A.1.(b)

O U T
N
(i)To find the total rent earned during certain time interval (input to be given by the user) for a

N
particular aptID.

G
I NM E
Ans:- Select aptID from Rent where aptID = '2'

(ii) To display all the aptIDs if the street ID and City are given.

Ans:- Select * from Apartment where street = 'Khajuri' and city = 'Varanasi';

S I G
(iii) To display the list of all the renters who have more than one apt.

U
Ans:- Select * from renter where name>= 2

A S U R
(iv) To display the list of all aptIDs whose rent is equal to or more than Rs.15,000/- per month in
a particular street with apt size more than 850sq feet

Ans:- Select * from Rent where rentpermonth>= 15000 and aptID.size > 850 ;

G
(v) To display all the details of the apartment which were bought before year 2000 in a particular
city and street.

Ans:- Select * from Apartment where year = '2000' and city = 'Varanasi' and street ='Khajuri';
11
IGNOU ASSIGNMENT GURU Page-

Q.1.(c)
A.1.(c)
Oracle lets you define procedures called triggers that run implicitly when an INSERT, UPDATE,
or DELETE statement is issued against the associated table or, in some cases, against a view, or
when database system actions occur. These procedures can be written in PL/SQL or Java and
stored in the database, or they can be written as C callouts.

/IGNOUASSIGNMENTGURU
BCA MCA BA MA BDP B.COM M.COM B.SC
http://www.ignouassignmentguru.com
Triggers are similar to stored procedures. A trigger stored in the database can include SQL and
PL/SQL or Java statements to run as a unit and can invoke stored procedures. However,
procedures and triggers differ in the way that they are invoked. A procedure is explicitly run by a
user, application, or trigger. Triggers are implicitly fired by Oracle when a triggering event
occurs, no matter which user is connected or which application is being used.

O U T
N
Data Access for Triggers

N
When a trigger is fired, the tables referenced in the trigger action might be currently undergoing

E
changes by SQL statements in other users' transactions. In all cases, the SQL statements run

G
within triggers follow the common rules used for standalone SQL statements. In particular, if an

I NM
uncommitted transaction has modified values that a trigger being fired either needs to read
(query) or write (update), then the SQL statements in the body of the trigger being fired use the
following guidelines:

 Queries see the current read-consistent materialized view of referenced tables and any

G
data changed within the same transaction.

I
 Updates wait for existing data locks to be released before proceeding.

U
The following examples illustrate these points.

S
Data Access for Triggers Example 1

R
Assume that the salary_check trigger (body) includes the following SELECT statement:

A S U
SELECT min_salary, max_salary INTO min_salary, max_salary
FROM jobs

G
WHERE job_title = :new.job_title;
12
For this example, assume that transaction T1 includes an update to the max_salary column of
the jobs table. At this point, the salary_check trigger is fired by a statement in transaction T2.
IGNOU ASSIGNMENT GURU Page-

The SELECT statement within the fired trigger (originating from T2) does not see the update by
the uncommitted transaction T1, and the query in the trigger returns the old max_salary value
as of the read-consistent point for transaction T2.

/IGNOUASSIGNMENTGURU

Anda mungkin juga menyukai