How To Exam?

a knowledge trading engine...


Punjab University 2008 M.C.A CS:43 - Unix and Shell Programming - Question Paper

Tuesday, 07 May 2013 07:30Web

PANJAB UNIVERSITY, CHANDIGARH
DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS
MIDTERM-II exam
NOVEMBER 11, 2008
CS:43 - Unix and Shell Programming

TOTAL MARKS - 20 TOTAL TIME - one hr

A) SHELL SCRIPT:

1. Write a Bourne Again Shell Script called test three that deletes from the current working directory all regular files that are not executable. [Marks 4]

2. The Bourne Again Shell Script test2 takes 1 command line argument, a data file that contains 1 integer per line. Complate the script (that is, complate the line beginning with sum=0) so that it adds all the numbers from the file, and reports the total.
#!/bin/sh
sum=0
for input in 'cat $1'
# Process 1 line of the file every time through the loop
do
sum=________________________________________
done
echo $sum [Marks 2]

3. Write a shell script to print Fibonacci series upto nth number. [Marks 4]

B) provide simple UNIX commands (you may use options, redirection and pipes) to accomplish every of the subsequent tasks: [Marks 10*1=10]

1. Create a directory with name *.*
2. Create a file which contains the message "unix is easy"
3. Convert all digits in 'filex' into questionmarks, and save the outcome to 'filey'
4. Show the jobs in Bourne Again Shell
5. Move the 1st job from background to foreground
6. change the permission of a file 'unix' in the current working directory, provide 'rwx' permission to the owner, 'r-x' permission to the group users, and --- permission to all the other users.
7. obtain out which version of the command "ls" you are using
8. Count the lines of all the .c and .h files in the current working directory.
9. give a 'grep' command that produces as output the 'number of lines' from "file.dat" that contain an upper or lower case letter.
10. Remove a subdirectory of the current working directory and all the files in it. The subdirectory's name is "junk". And you are needed to run the command in the background.




( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER Punjab University 2008 M.C.A CS:43 - Unix and Shell Programming - Question Paper