VTU Computer Science (Semester 3)
Unix and Shell Programming
December 2014
Total marks: --
Total time: --
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary

1 (a) Define briefly the UNIX architecture explaining the role played by the kernel and shell in sharing the work load.
8 M
1 (b) Draw the tree structure of the file system created by the following commands (assume you are in the directory / usr / office). Why is it not possible to issue the command rmdir / usr / office / right.
$ mkdir left
$ mkdir middle
$ mkdir right
$ cd left
$ mkdir left middle right
$ cd ../middle
$ mkdir dir1 dir2/usr/office/right/dir3
8 M
1 (c) Explain the concept of absolute path name and relative pathname.
4 M

2 (a) Which command is used for listing file attributed? Explain briefly the significance of each field of the output.
6 M
2 (b) Assuming that a file's current permission are rwx r_ _ r_x, specify the chmod expression required to change them to:
i) rwx rwx r_x
ii) r_x r_x _ _ x
iii) _ _ _ r_ _ r_ x
iv) _ _ _ rw_ r_ _,
using both relative and absolute methods of assigning permissions.
8 M
2 (c) Explain the three modes of vi and explain how you can switch from one mode to another.
6 M

3 (a) Explain the three sources of standard input and standard output.
6 M
3 (b) Explain what these wild-card pattern match:
i) [A-Z]????*
ii) *[0-9]*
iii) *[!0-9]*
iv) *[!s] [!h]
8 M
3 (c) What is a process? Mention briefly the role of fork-exec mechanism in process creation.
6 M

4 (a) What are hard links? Explain two application areas of hard-links. What are the two main disadvantages of the hard-link?
6 M
4 (b) Explain these commands with examples:
i) unmask
ii) touch
6 M
4 (c) Explain the following commands:
i) pr
ii) tail
iii) sort
8 M

5 (a) Explain the grep command with options.
8 M
5 (b) What is sed? Explain addressing in sed, with suitable examples.
8 M
5 (c) Explain the anchoring characters.
4 M

6 (a) Explain the special parameters used by the shell.
6 M
6 (b) What is shell script? Explain the following statements with syntax and examples;
i) if
ii) case
iii) while
10 M
6 (c) What is the 'exit' status of command and where is it stores?
4 M

7 (a) Explain awk's build-in variables.
6 M
7 (b) Write a program in awk to store the totals of the basic pay, da, hra and gross pay of the sales and marketing people.
6 M
7 (c) Briefly describe the built-in functions in awk, with examples
8 M

8 (a) Write a Perl script to determine whether the given year is leap year or not.
7 M
8 (b) Write a Perl script to convert decimal number to binary.
7 M
8 (c) Explain variables and operations in Perl.
6 M

More question papers from Unix and Shell Programming