You are on page 1of 18

-

. 101011 No. of Questions: 5 I [ Total No. of Printed Page. 3


Roll No _. _ _ .

MCA-502

M. C. A. (FHlh Semester) EXAMINATION, j une, 2008

UNIX AND SHELL PROGRAMMING

(MC\-SOZ)

Tune .. Three Houri

Maximum Marks : ]00

Minim um Pass Marks: 40

Note: Attempt any two parts from each question. All


questions carry equal marks.
Vnit-I

I. (8) Describe the architecture of UNIX operating system,


10
(b) What is buffer cache? Discuss all possible conditions
to manage buffer cache. 10
(c) Describe the various scenarios tha t can happen in
algorithm breada. What happens 011 the next
invocati on of bread or breada when the current
read-ah ead block will be read? 10
Unit -II

2. (a) What is (nodes and In-core lnodes ? Write an


algorithm for conversion of a path name to an Inode.
10
P. t O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org

- ~--.,...

I , I MCA-$ 02

(b) What is link system call ? Discuss the algorithm tor


linking a fil e. II}
ee) What is mount table? Discuss the algorithm for
mounting a file system. III
UJlit -1II

3. (a) What is u'llrea ? Explain the complete transition rules


and state infonnation of a process, 10
(b) Explain the operation performed by the kernel when
a process Is created. Discuss "fork" system call. 10
(c) What is IPC? Explain the system V-IPC packages.
10
uen -rv

4. (a) Wha t are basic functions of shell? Discuss different


types of shell used in UN IX OS. 10
(b ) When me shell creates a new process to execute a
command, how does it know W I the file is executable ?
If it is executable, ho w du'a il di5t;ngui,h l>etw(l.CO II
she ll script and II file produced by /I compilation ?
What is the eorree sequence for checking the above
calot:S ? 10
(e) Write a menu driven program which has the follow:ng
op tions (using case statement) : 10
(i) Contents of Ittel passwd
(ii) Present working directory
(iii) List of users who have curre ntly logged in
(iv) Etit

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org

I , I

VDII -V

s. (I) What is the utility of awk programming? Explain

different ecntrol structures supported b)' .....t

programming Ianguqc. 10

(b) Discuss various f1avoon and Iearures of linux

operating system. 10

(c) What is purl programming? Write a purl script to

convert a binary number (supplied as argument) 10

decimal number. 10

"'teA- 502 ..,00

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


TOI:!1No. of Questions: 8 l I Total No. of Printed POJ;:cs ; 2

MCA-502
\ M. C. A. (Fifth Semester)
EXAMlS ATlO N, Ncv-uee., 2007
UNIX AND SHElL PROGRAM MING
(MCA - S02:)
TIme : Three Houn
Maximum Marks: 1(}()
Minimum Pass Marks : 40

Note: Attempt any five questions. All questloru carry equal


marks. .

1. (a) Discuss in brief UNIX me system structure. 6


(b) Wh2t is BUFFER CACHE? How it improves the
perfo rmance of ?
II SYSlgn 8
(e) What should happen if the kernel atte mpts awaken all
processes sleeping on an event, but no processes are
asleep on the event at the time of the wnke up ? 6
2. (a) What is In-Core Inode ? Disccss an algorithm for
allocation of In-Core bode. 10
(11) Write an algorithm 10 convert a path name 10 an
lnode. 10
3. (a) What is super block ? Discuss the field; aesocimed
with super block. 4
(b) What is context switch? Where it is used ? 4
(c) Discuss Directory structu re of UNIX file S}S le m . Writo
an algorithm for conversion of byle offset 10 block
number in file system. 12
P. 1. O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


I , ]

4. (0) What is link system call ? Discuss the algorithm for


linking a file. 10
(b) Describe the mounting and unmeuming of file system.
JO
5. (,) Differentiate between named and unmamed pipes.
Discuss the pipe system call.
(b) Wh:u is Ij -area ?
12
,
(c) Describe all conditions where the reference count of
an inode can be greeter than I. 4

6. (a) DisCU5S the algorithm for "fork" system call. 10


(b) What is IPe ? Explain the system-V IJ'e packages. S
(,) What is UNIX Zombie process and why is the concept
necessary? 5
7. (a) Discuss different features of U NU X operating system.
5
(b) What are awk built in variables? 5
(c) Write a program that prints the owner, file type, access
permissions and access times of files supplied as
parameters. If a file is a directory, the program should
read the directory and print the above infcrmarion for
all files in the directory. 10

8. Write short notes on any four of the following: 5 each


(i) 111e SHELL
(H) Memory Management

(Iii) STAT and FSTAT

(iv) File permissions


(v) Process Slates transitions

MCA-S02 4,200

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


,
>

TOlal No. of Ouesuons : R I [Thllll No. of I'timed rages : 2

MCA-502

M. C. A. (Fifth Seml'Slt'r)

EXAMINATION. May/June, 2006

UN IX AND SHEil. PR OGRAMMING

(MCA -SOl)

T""e : 11uee Hours

Ml-lXimum Marks : 100

Minimum Pass Marks : 40

Note : Atte mp t <loy five questions. All <luc!tion~ (ilfry equal


marks .

1. (:I) Discus! briefly UNIX file system structure. 8


(b) Wlmt is buffer cache ? Draw the diagram of buffer
header. Write down advantages and disadvantages of
buffer cache. 12

2. (a) Discuss the Scenarions for retrie val of a buffer. 10


(b ) Wilat is Inodes and In-Core Inodes ? ni~155 the
algorithm for allocation of In-Core Inodes. 10

3. (a ) Discuss directory structure of UNIX fi le ~)Slem. 6


(b) Write an algorithm ror conversion of a path name to
an Innde. /I
(e) What i~ supe r hlock ? Disc=! ure fields ussecuned
with supe r block. ()
P. T. O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


- I

"]
4. (,) WhO! is Link System Call ? Discuss the algorithm for

linking a file. 10

(b) Differentiate between narned and unnamed pipes.

Discuss the pipe system cal,l. 10

5. (,) When executing the command ls-ld on a directory. the


number of links of the directory is never L Why ? 4
(b) Briefly discuss crossing of rnOUJlI point ? 4
)

Write an algorithm for un mounting :I file system. 12

6. (,) What are the components of the context of process ?


What are the steps for a context switch ? 8
(b) What is IPC? Explain the system-V IPC Packages ? 8

) What is Ll-area ? 4

7. (,) What is the useful permission setting for a file and a


directory '! Write the syntax fur the following; 8
(i) Cu '
(ii) Umask
(iii) Chmod
(b) Write a shell script that would pick up all ' C' progrlWl

filc ~ fro m the curre nt d irectory and edd th", Ext .. nsion

'.CPP' at the end of each ~uc h file. 8

) What are avk built in variables ? 4

8. Write short notes on any fo ur of the following : 5 each


(i) Open system call
(H) LI NUX security features
(iii) STAT and FSTAT
(iv) Fork system call

(, ) DuemOI1 process

MCA-S02 3....

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


,
Total No. oC Questions : 8 J [ Toml No. oC Printed Pages : 2

MCA- S02
M. C. A. (Fifth Semester) EXAMINATION, Dec., 2005
UNIX AND SHELL PROGRAMMING
(MCA -50Z)
Tune .. Three HOUT:i

Maximum Marks: 100

Minimum Pass Marks : 40

NOll' : Atte mpt any five questions. All questions carry equal
marks.
I. (a) What ls kernel? Draw block diagram c f the system
ke rn el. Explain it. 10
(b) What is directory execute permission? Compare and
contrast interrupts and exceptions. 10

2. (a) Wha t is buffer cache? Draw the diagram of buffer


header. Write down advantages and disadvantages of
buffer Cliche. 10
(b) Describe in detail the r-node directory file structure of
Unix Operating System. How is it different from tree
file di rectory structure? 10

3. (a)What is system call? Unde r what circumstances is it


important to know if a call to a library func tion resul ts
in a system call. 10
(b) Consider the following code fragmen t in Unix :
Pid_t Pid = fork ( ):
........ more code .
P. T. O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


1"

Explain how the code label "more rod e" would


determine whether the code being executed is in the
parent process or the child process. 10
4. (3) Describe the mounting and unmounli ng of file system.
10
(b) What is buffer cache 1 Draw the diagram of huffe r
header ? Write down advantages and disadvantages of
buffer cache. ]()
5. (a) What is Unix ecmbie process and why is the concept
necessary ? 10
(b) Write an algorithm for conversion of a path name to
an I node. 10
6. (a) What is context switch? Where is it used ? 5
(b) What is IPe ? Explai n the syste m-V IPe packages. 5
(,) Write the shell program to calculate factorial of u
number. I{)

7. (a) Design a directory structure that improves the


efficiency of searching for path names by avoiding the
linear search using techniques of hashing. 10
(b)' What is the utili!)' of awk programming? Explain
different contro l structures supported by awk
programming language. 10
S. Write shor t notes on the following ; 5 each
(a) Socket problems
(b) Semaphores
(e) STAT and FSTAT
(d) Pipes in Unix O. S.

MCA-SOl 4,010

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


Total No. of Ouestlo ns : 8 J [ Thtal No. of Printed Pages : 3

MCA-502

M. C. A. (Fifth Semester) EXAMINATION, june, 2005


UNIX A..~D SHEll PROG RAMMING
(MCA S02)
Tvne : Three Hours
Maximum Marks: 1()()

Minimum Pass Marks : 4[J

Note : Attempt any five questions. All questions carl')' equal


=IG.
1. (a) Describe briefly the architecture of UNIX operating
system. 8
(b) What is buffer cache? Explain in brief the structure
of buffer pool. 12

2. (a) Write an algorithm to convert a path name to an


lnode. 10
(b) Write an algorithm for conversion of byte offset to
block number in file system. 6
(c) Describe the structure of Incde. 4
"3. (a) Write an algorithm for reading a file. 10
(b) Discuss the algorithm for changing current directory. 6
(0) What could happen if the kernel would allow the
process to mount the same file system simuItaneousty
at two mount points ? 4
P. T. O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


='*

1"
4. (3) Explain the following shell s tatements laking suitable
shell script: 10
(ll For
(ii) Expr
(iii) Ten
(iv) Case
(b) The length and breadth of a rectangle and radius of
a circle are input through the keyboard. Write a

shell script to ccnlateeatc the area ::nd perimeter of
the rectangle and the area and circumference of the
circle. 10

5. (01 Write an algorithm for linking files. 10


(bl Discu ss deadlock scenario for link syste m cell. 0
(e) What should happe n if a process attempts 10 unmoun;
a file system and another process in simultaneously
attempting to create a new file on that fil e system ?"

6. (01 Wha t is precess sta te tr ansi tion ? 8


(bl Discuss the algorithm for fork system call.
(el Brie fly d iscuss Inter-Process com mu nication. ,
S

7. (n) Write a shell scrip t wh ich displays a Iisl of all riles in


the a m en! directory to which you have read, write and
execute permissions? . 10
(b) What are awk built-in variables? 4
(c) Write an Interactive script that asks for a word and a
filename and then tells bov. many tines that word
occurred in the file, using awk programming. 6

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


I , I
8. Write short notes on any f our of the following : 20
(a) Context of a process
(b) UNU X Security features
(c) Pipe System cell
(d) Compress and Peak command
(e) Memo ry Management

MCA- S02 3,490

. .
Courtesy: Bansal Institute of Science & Technology, Bhopal
-

http://bist.dyndns.org
'

'Total No. of Ouestlons : 8 1 [ Total No. of Printed Pages : 2

MCA-502
M. C. A. (Fifth Semester) EXAMINATIO N, Dt'C.,200.t
\1 UN IX Ai'll) SHELL PRO GRAMMING
(MCA- SOl)

Time: Three flours

M~imum Marks: loo

Minimum Pass Marks: 40

Note : Attempt any five questions. All questions carry equal


marks.

1. (a) Discuss briefly U NIX file system structu re. R


(h) What is buffer cache ? Discuss the scenario for rctrival
ofabufur. 12
2. (a) What is In-Core Inod e ? Explain an algorithm for
allocation of In-Core [nod e s. 10
(h) A file system should never cmtain a free inode whO!oe
inode number is Jess than the remembered irnxle used by
Ianoc How is it possible for this assertion to be false? 10
3. (a) Differentia te between named and unamcd pipes.
Discuss the pipe system call. 8
(b) Describe the conditions where the reference count of
an illude can be greater than I. 5
(el What IS mount table ? Discuss an algorithm for
mounting a file system. 7
4. (a) What is link system call? Discuss the algorithm for
unlinking a file. 10
P. T. o.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


I, I
(b) Wha t is U-a rca ? 4
(c) W hat arc the steps for a context switch? Explain it. 6

5. (u) Willi! Kernel docs for process creation? Discuss an


ulgorithm for fork system call. 10
(0) Compare lind contrast messages, shared memory and

\ 6. (a)
semaphore mechanisms.
Exp lain the following shell statement laking suitable
shell script :
(i) While
10
10

( ii ) Until
(iii) Test
( iv) If else
(b) Write a shell script to find the Greatest Common
Divisor (Ge D) for the given number 120 and 9. 10
7. (a) What arc a..... k built in variables? 4
(b) Write a shell script which receive filename <IS
argument. Check whether it LS a file or directory '! If
it is a filename then name of the file as well as the
number of lines present in it 'I Should be reported.Hl
(c) Write an Interacdve script that ask for a word and a
filename and then show how man y times that word
occurred in the file (using awk} ? 6

8. Write short notes on any fou r of the following: 20


(i) File types in UNIX
(ii) Slate Transition
(iii) Ir ucrproccsscs Communicatio n
(ill) O pe n Syste m Call
(II) U NUX Security Fea tures

MCA.-502 4,050

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org


.

":"olal No. of Questions : 8 I [ Total No. of Primed Pages : 2

MCA-502

M. C. A. (F ift h Semest('l') r.: XAMINATION, June, 2004


UN IX AND SHELL PR OGRAMMII\G
. (MCA -S02)
, TIme; 17l1e" Iluur.,
Maxim um Marks : 100
Minimum Pass Marks .. 40

Note : Attempt any five q.lestions.

1. (a) Describe architecture of UNIX Operating System. 10


(b) Describe a scenario where the buffer data is already
valid in algorithm that reads a disk block. 5
(c) Write down the strengths of UNIX Operating SystCITL 5
2. (a) Explain in brief tht' ,tru~ lU [e of a regular file. Write
down an algorithm for the inode assignment to a new
file . 10
(b) Design a directory structure that improves the
efficiency of seardling for path names by avoiding the
linear search. 10
3. (a) Describe any flW! syste ms caDs for fit" syste m. 10
(b) Describe various states and their transitions during the
life lime of a process, 10

4 . (a) Write down the algorithm [Of 'sleep'. 10


(b) Discuss "process creation" in detail. 10
P. T. O.

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org

I a I

5. (a) What do you understand by process tracing ? What arc '


the drawbacks of using 'pirace' '] 10
(b) Briefly discuss Master lind Hare process. 5
(c) Discuss various meta characters of shell. 5
6. (a) Briefly discuss various types of shells. 6
(b) Write down a shell script which deletes all Hoes
containing the word 'unix' in the files supplied as
arguments 10 this shell script. 10
(c] Explain the case comrol structure. 4

7. (a ) Write any / h'e awkhuilt in function. 5
(b ) Explain through a suitable example how 'a wk' handles
array. 5
(c) Write a note on various linux fl avours. 10
8. Write short notes on any fou r of the following : 20
(a) Super block
(b) Pipes in Unix
(e) Delayed write of a block
(d) Kernel data structures
(e) Muhipr ocessor systems

MCA- SOl 3,150

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org

Total No. of Questions : 8 ] I Total No. of Printed Pages : 2

MCA-502

M. C. A. (Fifth Semester) EXAML"'JATION. n, 2003


UNIX AND SHELL PROGRAMMU,G
(Ma-502)
T ime : Thru Houn

Maximum Marks : J()()

Minimum flw' Marks : 40

NOlt : Attempt any {rve questions. All questions carry equal


marks.
I. (.) Differentiate between user mode: and kemaJ mode. 5
(b) DiM:ms in brief file: system structure. 5
(,) What !hould bappc:n if ke:mal attempts to awaken all
processes sleeping on an event, but no process are
asleep on the event at the time of wake up ?
2. (.) Discuss the scenarios in ~taiJ for retrieval of a buffer.
I.
10
(b) Disarn upon advantages and disadvantages of buffe r
casche. 10
3. (.) What arc: the fields contained in modes ? Briefly
describe the need of each of these fields. 8
(b) wrne algorithm to CO~ M a pathnamc: 10 an inede.B
(,) Enumerate the file type:~ supported by UNIX. ,
4. (a) Describe all. eondiuons where refere nce count of an
inode can be greater than 1. 8
P. T. O.


Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org
.'

IaI
(b) Di fferentiate between named and unnamed pipes.
Discuss the pipe system call. a
(0) Briefly discuss crossing of mount point. 4
5. (,) What are the components of the context of process '}

What are steps for a context switch? 8
\
\ (b) What do you understand by raising the processo r
execution level'} Write algorithm for wakeup. 8 ~
(0) What is U area? 4

6. (,j Co mpare and contrast messages, share d memory and


semaphore mechanisms. 10
(b) Expl ain following shell statements taking suitable shell
scripts : 10
(i) Case
(ii) While
(iii) U ntil ,
7. [a) Wh at are awk built in variables '} 5
(b) Write a shell script so that distance between two cities
is enter ed in kilometers through keyboard and it is
printed in meters. 8
(0) Explain the use of BEG IN and END section in awk
programming. 7
8. Write short notes on any foUT of the following: 20
(,) Stat e transition
(b) Link system call
(0) GUI and other feature s of UNU X
(d) Ba ckground process
(,) UN IX security features

MCA -S02 4,400

Courtesy: Bansal Institute of Science & Technology, Bhopal http://bist.dyndns.org