CS代写 ICT374 Sample Exam Paper Page 1

ICT374 Sample Exam Paper Page 1
ICT374 Operating Systems and Systems Programming Final Examination
Time Allowed 2 hours plus 10 minutes reading time
INSTRUCTIONS

Copyright By PowCoder代写 加微信 powcoder

1. There are 15 pages in this Paper, including 3 blank pages at the end.
2. The questions are divided into three parts with a total of 100 marks.
3. Part I consists of 25 multiple-choice questions, worth 1 mark each and 25 marks in total.
4. Part II consists of 5 questions, worth a total of 40 marks.
5. Part III consists of 3 questions, worth a total of 35 marks.
6. Attempt all questions.
7. For questions in Part I, mark your answer to each question in the Computer Answer Sheet (not on
this Question Book). You must use a blue or black pen, not a pencil, to mark your choice.
8. For questions in Part II and Part III, write your answer directly on this Paper in the space below
each question.
9. If more space is required, continue your answer on the blank pages at the end. Make clear on the
original page that your answer is to continue on a blank page and give the page number.
10. Use the back of each page for rough notes if required.
Your Name: _________________________________________ Your Student Number:_________________________________ Your Signature:_______________________________________
EXAMINATION AID ALLOWED Provided by the University
Provided by the Candidate
Closed Book Examination – No Calculators Permitted

ICT374 Sample Exam Paper Page 1
Part I: Multiple-Choice Questions. (1 mark x 25 = 25 marks). Mark your answer to each question in the Computer Answer Sheet (not on this Question Book). You must use a blue or black pen, not a pencil, to mark your choice.
Note each question has between four and six choices labeled a, to e. You should read all choices before answering the question as some questions may span over two pages.
1. An interrupt can be triggered by
a. Multiply by zero
b. Initiation of a disk read
c. Completion of a disk read
d. Output to the terminal screen
2. The four basic elements of a computer are
a. Processor, main memory, I/O modules and system bus
b. Main memory, processor, hard disk, and keyboard
c. Processor, DMA, system bus, and I/O devices
d. CPU, peripheral devices, operating system, application software
3. The Process Image element that contains the modifiable part of the user space is called the:
a. User Program
b. System Stack
c. Process Control Block
d. None of the above
4. A process switch may occur when the system encounters an interrupt condition, such
as that a. b. c. d. e.
generated by a: Memory fault Supervisor call Trap
All of the above None of the above
5. The term Principle of Locality means
a. It is preferable to use local variables rather than global variables
b. It is preferable to use cache memory rather than main memory
c. It is possible to guess about which pieces of memory will be needed in the
near future
d. Virtual memory
6. A disk cache
a. Is a small disk
b. Is a fast disk

ICT374 Sample Exam Paper
c. Is created in the main memory
d. Is created in the secondary memory
7. Given the following Unix code excerpt: execl(“/bin/ls”, “ls”, (char *)0);
printf(“end of ls\n”);
What is the most likely output from the above code?
a. Listing of the filenames in the current directory
b. Listing of the filenames in the current directory followed by the line “end of ls”
c. An error message
d. No output will be generated
a. A daemon process is usually a server process
b. Each daemon process has a controlling terminal
c. A daemon process usually keeps running until the machine is shut down
d. A daemon process usually reports error and diagnostic information by writing
a message to a log file
9. What information is stored in the system-wide File Table in a classic Unix system?
a. I-node information, file length, file status flags
b. I-node information, V-node information, current file size
c. File status flags, current file offset, v-node pointer
d. None of the above
10. It is well known that when reading and writing a disk file, the size of the buffer used in the program can affect I/O performance. How would you select the buffer size in order to improve I/O efficiency?
a. Use a buffer whose size is a multiple of 1000
b. Use a buffer whose size is a multiple of 1024
c. Use a buffer whose size is a multiple of the disk block size
d. Use a buffer whose size is as big as possible
11. Assuming a directory contains two regular files named “abc” and “xyz”, what would be the content of that directory file?
a. The contents of the files “abc” and “xyz”
b. The file names “abc” and “xyz”
c. The file name and i-node number mapping for files “abc” and “xyz”
d. The file name and i-node number mapping for files “abc” and “xyz” as well as
the i-node numbers of the directory itself and its parent directory
of the following statements about daemon process is false?

ICT374 Sample Exam Paper Page 3
12. Which signal would be sent to the foreground processes by pressing Ctrl-C on the keyboard?
a. SIGKILL b. SIGCHILD c. SIGQUIT d. SIGINT
13. What does the following system call do? pause();
a. Pause the calling process for 1 second
b. Suspend the calling process until a signal is received and processed.
c. Pause the calling until SIGALRM is received
d. Pause the calling process until its child process catches up
14. What is the effect of the following function call to the calling process? signal(SIGINT, SIG_IGN);
a. Send signal SIGINT to the foreground processes
b. Install signal handler for SIGINT
c. Pressing Ctrl-\ will kill the calling process
d. Pressing Ctrl-C will not kill the calling process
15. In the reliable signal model, a signal is “pending” means?
a. b. c. d.
16. Which a. b. c. d.
The signal is not yet generated
The signal is generated but not yet processed The signal is ignored
The signal is caught
system call would you use to unblock certain signals? sigaction
sigprocmask
sigpending
17. In Unix programming, mutual exclusion can be implemented by using
a. Multiple threads
b. A binary semaphore
c. Signals
d. All of the above
18. In operating systems, the Producer-Consumer Problem is used to
a. Produce items for consumption
b. Illustrate and test the synchronization of multiple processes

ICT374 Sample Exam Paper
c. Implement semaphores
d. Generate random numbers
a. UDP is a connectionless protocol
of the following statements about UDP is false?
b. UDP preserves message boundaries
c. UDP provides sequencing
d. UDP incurs less overhead compared with TCP
e. None of the above
20. In a network application using TCP, what is the system call accept used for?
a. The client uses the system call to receive a message from the server
b. The server uses the system call to receive a message from the client
c. The client uses the system call to wait for a server connection request
d. The server uses the system call to wait for a client connection request
21. In a network application using TCP, what is the system call bind used for?
a. The client must use the system call to bind an address to the client socket
b. The server must use the system call to bind an address to the server listening
c. The client and server use the system call to bind each other
d. A TCP application does not have to use the system call
22. In a system employing a segmentation scheme for memory management, a process is divided into:
a. One segment per thread
b. A number of segments which must be of equal size
c. A number of segments which need not be of equal size
d. None of the above
23. The real address of a word in memory is translated from the following portions of a virtual address:
a. Page number and frame number
b. Page number and offset
c. Frame number and offset
d. None of the above
24. The replacement policy that is impossible to implement because it would require the O/S to have perfect knowledge of future events is called the:
a. Optimal policy
b. Least recently used (LRU) policy
c. Clock policy

ICT374 Sample Exam Paper
d. None of the above
25. The situation that occurs when the desired page table entry is not found in the Translation Lookaside Buffer (TLB) is called a:
a. TLB miss
b. TLB hit
c. Page fault
d. TLB fault

ICT374 Sample Exam Paper Page 6
Part II. Complete the following system programming questions. There are 5 questions in this part worth a total of 40 marks. Write your answer directly in the space under each question.
1. (8 marks) Write a program that reads a line of input from the standard input and then reverse the line. Finally print out the reversed line on the standard output.
2. (8 marks) Write a program that
a) prints a list of its environment variables (and their values); and
b) prints out the current directory of the process as well as the user who invokes
the program.

ICT374 Sample Exam Paper Page 7
3. (8 marks) Write a C program fragment to demonstrate how the standard input of a process may be redirected away from the terminal keyboard to a file.
4. (8 marks) Write a UNIX program to demonstrate how a child process passes a message to its parent process using an unnamed pipe.

ICT374 Sample Exam Paper Page 8
5. (8 marks) Read the following program. Assuming that you run the program on the foreground from a terminal, answer the following questions:
a) What would happen if you type Ctrl-C on the terminal, and why?
b) What would happen if you type Ctrl-\ on the terminal, and why?
c) What would happen if you type Ctrl-C three times in quick succession on the
terminal, and why?
#include #include
void catch(int signo) {
printf(“Signal %d caught\n”, signo);
sleep (2); }
int main() {
struct sigaction act;
act.sa_flags = 0; act.sa_handler = catch; sigfillset( & (act.sa_mask) );
if (sigaction(SIGINT, &act, NULL) != 0) { perror(“sigaction”); exit(1);
for (i=0; i<100; ++i) { printf("sleep %d ....\n", i); sleep (1); exit(0); } ICT374 Sample Exam Paper Page 9 Part III. Complete the following operating system theory questions. There are 3 questions in this part, worth a total of 35 marks. Write your answer directly in the space under each question. 1. (10 marks) Briefly describe the four types of interrupts. a) Program d) Hardware failure ICT374 Sample Exam Paper Page 10 2. (10 marks) This question is related to inverted page tables. a. Describe how the Inverted Page Table works. You should use diagrams and examples to help illustrate the concept. b. Discuss the strengths and weaknesses of the inverted page table compared to the normal page table. ICT374 Sample Exam Paper Page 11 3. (15 marks) A simple virtual memory system has 32KB physical memory with 16-bit virtual address, of which 12 bits are used as offset. The current content of its page table is given below: Virtual Page Number 15 Page Frame Bits 000 010 000 000 111 000 101 000 000 000 011 100 000 110 001 000 Present / Absent bit 0 a) What is the page size of this virtual memory system? b) What is the corresponding physical address of virtual address EA0C (in hexadecimal notation)? c) What would happen if the CPU executes an instruction to move an integer from memory address C6A0 (hexadecimal) to a register? (you can continue your answer on the next page.) ICT374 Sample Exam Paper Page 12 (you can continue your answer on this page.) END OF QUESTIONS ICT374 Sample Exam Paper Page 13 Blank page 1 ICT374 Sample Exam Paper Page 14 Blank page 2 ICT374 Sample Exam Paper Page 15 Blank page 3 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com