Get premium membership and access revision papers, questions with answers as well as video lessons.
Got a question or eager to learn? Discover limitless learning on WhatsApp now - Start Now!

Tlcm 323: Unix, C And Shell Scripting Question Paper

Tlcm 323: Unix, C And Shell Scripting 

Course:Bachelor Of Telecommunication And Information Engineering ()

Institution: Kabarak University question papers

Exam Year:2011




KABARAK UNIVERSITY
UNIVERSITY EXAMINATIONS
2011 ACADEMIC YEAR
FOR THE DEGREE OF BACHELOR OF TELECOMMUNICATION
TLCM 323: UNIX, C AND SHELL SCRIPTING
DAY: THURSDAY DATE: 02/08/2012
TIME: 9.00 – 12.00 P.M. STREAM: Y3S2

INSTRUCTIONS:
There are 5 questions in this paper. Answer Question 1 and Any Other Three
Question 1 (40 Marks) –Compulsory Question
a) What is an operating system? Give two functions of an operating system. (3 marks)
b) What do the following commands do: (4 marks)
(i) rmdir
(ii) mv
(iii) ls
(iv) mkdir
c) Differentiate between system software and application software. Give one example of
each. (4 marks)
d) What are the major components of the UNIX operating system? Briefly describe each.
(8 marks)
e) Differentiate between complex commands and compound commands. Give an example of
each. (4 marks)
f) What are the three main uses of the shell? Name two main types of shells. (5 marks)
g) Give one reason why Unix is more popular than most operating systems in the market
nowadays (2 marks)
h) What are the symbols for input redirection and output redirection? What are their
purposes? (4 marks)
i) What are the four ways of creating UNIX files? (4 marks)
j) Give two flavours of the Unix operating system (1 mark)
k) Why is the shell called a command-line interpreter? (1 mark)

Question 2 (20 Marks)
a) The Unix file system has a tree-like structure;
(i) Write the absolute path for the directory “steve”. (2 marks)
(ii) Assuming your current directory is “etc”, write the relative path to the directory
“jon”. (2 marks)
b) Briefly describe the three types of files in UNIX. (6 marks)
c) You have logged into the UNIX system of your University and you would like to perform
some activities -What are the sequences of UNIX commands that you would use to
perform each of the activities below? (10 marks)
(i) Know your current position in the system, and also know who are the other users
connected to your system.
(ii) Know your terminal name and the type of shell you are using.
(iii) Change your password.
(iv) View the calendars of 2012 and 2013, one screen at a time (hint: Use piping
operation).
(v) Create a new sub-directory called Elections in the Desktop directory of your home
directory.
(vi) Change to the Elections directory
(vii) Create a new file called County containing the following: Mombasa, Kericho,
Kisumu, Bondo. (hint: Use redirection)
(viii) In the current directory, create a copy of County file and name it County-Copy.
(ix) Add onto the County file the following: Nairobi, Nakuru, Eldoret, Kabarnet,
Kiptagich.
(x) View the contents of both County and County-copy files.

Question 3 (20 Marks)
a) Vi editor is a modal editor: using a diagram, show the different operating modes of the
Vi editor and show how you can switch between them. (3 marks)
b) What are the vi command keys for doing the following activities? Also, where
applicable mention the operating mode of the vi editor in which the command keys are
executed in. (6 marks)
(i) Writing changes in the STUDENTS file to a different file named RECORD.
(ii) Correcting the word ‘stutent’ to ‘student’
(iii) Opening a new file named UNIVERSITY
(iv) Deleting the current line
(v) Exiting the vi editor without saving
(vi) Adding text to an existing file
c) Describe the positional parameters type of variables. Why are they also known as readonly
or automatic variables? (2 marks)
d) What do the following positional parameter variables contain? (2 marks)
(i) $*
(ii) $#
e) Write a shell script named EX1 that takes file names as command-line arguments and
changes the access permissions on the file so that the owner may be able to execute
the file. In addition, display a message showing the name of the file that has been
changed. (Add comments to make your script readable) (4 marks)
f) Write a shell script named EX2 that will take 2 numbers as command line arguments,
adds them together and then displays the sum of the numbers to the user. (Add
comments to make your script readable) (3 marks)

Question 4 (20 Marks)
a) Describe the following types of variable classes: (4 marks)
a. Shell variables
b. Local variable
c. Environment variables.
d. User defined variables
b) What is contained in the following shell variables: PWD, HOME? (2 marks)
c) Write a shell script named EX3 that will prompt users on the following: Name, Country and
Title, and capture their input. The script should also print out a meaningful message out of
the user’s input. (Add comments to make your script readable) (3 marks)
d) Differentiate between the following control structures: selection structures and iteration
structures. (2 marks)
e) Using the for loop control structure, write a shell script named EX4 that will list all the files
and directories in the current directory. (Add comments to make your script readable)
(4 marks)
f) Differentiate between scalar variables and array variables. Write the syntax for defining
each of these types of variables. (4 marks)
g) You place variables in an environment by exporting them. Write the syntax for exporting
variables. (1 mark)

Question 5 (20 marks)
a) Define the following terms: (3 marks)
a. Shell script
b. Text editor
c. Shell Function
b) What is the difference between shell scripts and shell functions? (2 marks)
c) Write a shell function called CHECK that executes the following commands: date, df and ps.
(3 marks)
d) Using the case statement control structure, write a shell script named EX5 that will prompt
users to select their favourite day of the week from a list of days presented to them in a
menu format, and then relay a meaningful message back to them for which ever day of the
Page 5 of 5
week they selected. (Add comments to make your script readable)
(6 marks)
e) Give two functions of the UNIX system administrator. (2 marks)
f) What are the key files used by the system administrator in user administration?
(2 marks)
g) Shell scripting is important for UNIX system administration –give two ways in which scripts
help system administrators in carrying out their work. (2 marks)






More Question Papers


Popular Exams



Return to Question Papers