Get premium membership and access revision papers, questions with answers as well as video lessons.
Comp 321:Unix And C Programming November 2010 Question Paper
Comp 321:Unix And C Programming November 2010
Course:Bachelor Of Computer Science
Institution: Kabarak University question papers
Exam Year:2010
KABARAK UNIVERSITY
UNIVERSITY EXAMINATIONS
2010/2011 ACADEMIC YEAR
FOR THE DEGREE OF BACHELOR OF COMPUTER
SCIENCE
COURSE CODE: COMP 321
INSTRUCTIONS:
1. Answer ALL questions in section A
2. Answer any TWO questions in section B
SECTION A (30MARKS)
QUESTION ONE (30MARKS)
a) What is an operating system? What are some of the services an operating system can
offer? (5marks)
b) Who is a system administrator? What is his function? (3marks)
c) Programming languages have rules for constructing constant. What are the rules used to
construct the C integer constants? (5marks)
d) Write a simple c program to calculate the simple interest. (5marks)
e) The administrator has the responsibility to create usernames and passwords to users of
UNIX operating system. Explain the command for changing the password. (2marks)
f) What are the two observations you can make concerning the UNIX commands?
(2marks)
g) Sometimes you might want to kill a line because it has many mistakes. What command
can you use to kill a line and what problems can you encounter when killing a line?
(5marks)
h) Write a command you will use to create a directory by the name mydoc and create a file
in it by the name file1. (3marks)
SECTION B (40 MARKS)
QUESTION TWO (20MARKS)
a) Write a c program that will calculate the average of n values using a while loop.
(5marks)
b) Explain the syntax of the if statement and give the flow chart. (5marks)
c) Discuss the structure of a UNIX command. (2marks)
d) The shell is a command processor you can perform or execute many UNIX commands I
shell. You can perform the pattern matching also called the wild cards. Discuss the * and
?. (3marks)
e) The following segment was extracted after a command was executed in UNIX command
line explain it and what is the command that was used to get the output. (5marks)
drwxr-xr-x 61 root sys 3584 Nov 3 19:20 etc
QUESTON THREE (20MARKS)
a) What is vi? Explain the three mode of the vi. (5marks)
b) Discuss the following commands as they are used in vi editor, x, wq, q, o, O, a, A, I.
(5marks)
c) Another machine in the network. Briefly discuss the following: -
i. DNS. (1mark)
ii. Host. (1mark)
iii. What does hostname do in UNIX? (1mark)
iv. IP address. (1mark)
v. Why do we use talk command in UNIX. (1mark)
d) What is the purpose of the following commands in UNIX, finger, telnet, rlogin and rcp.
Give example of how they are used. (5marks)
QUESTION FOUR (20MARKS)
a) UNIX is a time-sharing system where several users’ miles apart can log on to a central
machine and use it to send messages. Discuss the mail and elm commands in UNIX.
(3marks)
b) What is the purpose of this two files .signature and .forward in UNIX? (2marks)
c) You are a C programmer and a student comes to you asking you to write a program that
will select the largest of three numbers. With this information at hand write a simple C
program that will perform this task. (5marks)
d) What is an array? Explain this concept of array using a simple program to find the
average marks obtained by 30 students in a class test. (5marks)
e) The permissions of a file are the first line of defense in the security of a UNIX system.
Discuss the permissions that are used in UNIX. (5marks)
QUESTION FIVE (20MARKS)
a) There are on-line manuals which gives information about most commands. The manual
pages tell you which options a particular command can take, and how each option
modifies the behavior of the command. Explain the online manual man and the apropos.
(2marks)
b) What is a function? Why do we use functions in C programming? (3marks)
c) UNIX is an operating system like other OS. You can write and execute different
programs written using programming languages. A person approaches you with the
problem of writing and executing a c program in UNIX. Discuss briefly how you will
inform the person how to write , compile and execute the C program in the UNIX
operating system using the vi editor. (6marks)
d) Discuss redirection. (3marks)
e) Changing file permissions is a security feature provided by UNIX and protects the file
from all except the owner. Explain the command to change the file permissions.
(3marks)
f) What are characters in c Programming language and what are its categories?
(3marks)
More Question Papers