r05320503 Unix Programming
r05320503 Unix Programming
r05320503 Unix Programming
1
III B.Tech II Semester Regular Examinations, Apr/May 2008
UNIX PROGRAMMING
(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”. Jus-
tify this statement with suitable examples. [16]
2. (a) Explain the different approach taken by diff command to display file differ-
ences.
(b) Describe ‘comm’ command. Explain the output with -1,-2, or -3 options in
‘comm’ command. [8+8]
3. (a) Write a shell script which reports names and sizes of all files in a directory
(directory would be supplied as an argument to the shell script) whose size is
exceeding 1000 bytes. The filename should be printed in descending order of
their sizes. The total number of such files should also be reported.
(b) Write a C program to search for the word ‘exam’ in a given file, using Com-
mand line arguments. [8+8]
5. Write a C program to print the type of specified file (Regular, device, directory)
[16]
8. Write about system call pipe . Give an example which uses pipe system call. [16]
⋆⋆⋆⋆⋆
1 of 1
Code No: R05320503 Set No. 2
III B.Tech II Semester Regular Examinations, Apr/May 2008
UNIX PROGRAMMING
(Computer Science and Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
1. What is an operating system? Explain how UNIX fulfills more than that role.
Discuss suitable examples. [16]
2. Discuss the various backup utilities available in UNIX. Ilustrate with suitable ex-
amples. [16]
3. (a) Write a shell script to accept a string from the terminal and use ‘case’ to echo
a suitable message if the string does not have at least 10 characters using:
i. case
ii. expr
(b) Write a shell script to display the processes in the system five times every 30
seconds using:
i. while loop
ii. for loop. [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 a program which used both kill and raise functions. [16]
7. Write the differences between fcntl function and flock function. [16]
⋆⋆⋆⋆⋆
1 of 1
Code No: R05320503 Set No. 3
III B.Tech II Semester Regular Examinations, Apr/May 2008
UNIX PROGRAMMING
(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”. Jus-
tify this statement with suitable examples. [16]
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.
(a) kill
(b) raise
(c) alarm
(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]
⋆⋆⋆⋆⋆
1 of 1
Code No: R05320503 Set No. 4
III B.Tech II Semester Regular Examinations, Apr/May 2008
UNIX PROGRAMMING
(Computer Science and Engineering)
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
⋆⋆⋆⋆⋆
2. Which is the command used for ordering a file? Discuss all the options available
for this command. For every option explain with an example. [16]
3. (a) Write a shell script which will receive any number of filenames as arguments.
The shell script should check whether every argument supplied is a file or a
directory. If it is a directory it should be appropriately reported. If it is a
Filename then name of the file as well as the number of lines present in it
should be reported.
(b) Write a C program to simulate ‘tail’ command. [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]
(a) open
(b) creat
(c) read
(d) write. [16]
8. Explain the concept of IPC between two processes on a single system. Give Exam-
ple. [16]
⋆⋆⋆⋆⋆
1 of 1