JNTU B.Tech II Semester UNIX PROGRAMMING, Examinations, Apr/May 2008
(Computer Science and Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
1. “Operating systems like UNIX provide services both for programs and users”. Justify this statement with suitable examples. 
2. (a) How to remove duplicate lines from a file using sort?
(b) How to count the number of ordinary files in home directory tree?
(c) Select lines 5 to 10 of a file in two ways. [5+5+6]
3. (a) Write a shell script for the following task.
The word ‘unix’ is present in only some of the files supplied as arguments to the shell script. Your shell script should searched each of these files in turn and stop at the first file that it encounters containing the word ‘unix’. This filename should be displayed on the screen.
(b) Write a C program which receives file names as command line arguments and display those filenames in ascending order according to their sizes. [8+8]
4. (a) Write a shell script which gets executed the moment the user logs in. It should display the message “good morning/good afternoon/good evening” depending upon the time at which the user logs in.
(b) Explain about here documents with an example. [8+8]
5. (a) Write and explain about hard and symbolic links.. give an example for each.
(b) Explain about file descriptors & i-node? [8+8]
6. Write the syntax of following functions. Explain each argument.
(d) exit. [4+4+4+4]
7. (a) Write a C program to use a function lock test to test for a lock.
(b) Write about lockf function. [8+8]
8. Explain the following concepts about pipes
(a) Pipes between two process
(b) Pipes among three process in a shell [8+8]