You are on page 1of 3

Test  |  7.

95

Test

Operating System Time: 60 min.

Directions for questions 1 to 30:  Select the correct alterna- 8. When a process is created, its state is
tive from the given choices. (A) New
1. A program is _____ entity, while a process is _____ (B) Ready
entity. (C) Block
(A) Active, passive (D) Suspend
(B) Active, sometimes active 9. The data section of a process in memory contains
(C) Passive, active (A) Local variables, function parameters
(D) Both (B) and (C) (B) Return addresses
2. All the information associated with a specific process is (C) Global variables
contained in: (D) None of the above
(A) Process control block 10. Which one of the following is true about process states?
(B) Program control block (i) A process which is running must have terminated
(C) TLB as next state.
(D) Heap (ii) From running state process can go to either wait-
3. Kernel-level threads and user-level threads are sup- ing, ready or terminated state.
ported, respectively, by _____. (iii) Only one process can run at any instant.
(A) Operating system and operating system  (iv) Ready process can go to waiting state.
(B) Operating system and user
(A) (i), (ii), (iii)
(C) User and user
(B) (ii) and (iii) only
(D) None of these
(C) (i) and (iv) only
4. Which of the following is false about user-level (D) (ii), (iii), (iv)
threads?
11. Message passing model of inter process communica-
(A) User-level threads are visible to the programmer
and are unknown to the Kernel. tion can be
(B) These are faster to create. (A) Blocking only
(C) Kernel never interferes. (B) Blocking and non-blocking
(D) There is no effect of a system call () on process. (C) Synchronous and asynchronous
(D) Both (B) and (C)
5. Which of the following interprocess communication
models are implemented using system calls? 12. The definition of wait( ) is as follows:
(A) Shared memory wait (S) {
(B) Message passing while (S <=0);
(C) Both (A) and (B) S - - ;
(D) Neither (A) nor (B) }
6. Peterson’s solution The semicolon after while statement, signifies
(i) is restricted to two processes (A) Infinite looping
(ii) share two data items turn and flag [i] (B) Blank statement
(iii) mutual exclusion is achieved (C) Depends on interpretation of compiler
(iv) is a hardware solution (D) No operation
Which of the above are true? 13. To avoid race condition, the number of processes using
(A) (i), (ii), (iii) the critical sections is/are:
(B) (ii), (iii), (iv) (A) 1 (B) 2
(C) (iv), (i), (ii) (C) 3 (D) More than 3
(D) (i), (ii), (iii), (iv) 14. The ‘Critical Section’ is the region in which
7. Which of the following requires a mode switch from (A) Any number of processes can enter without any
one thread to another? permission
(A) One process multiple thread (B) Only one process enters at a time and others wait
(B) User-level thread for it.
(C) Kernel-level threads (C) Section is very critical
(D) Both (B) and (C) (D) None of these
7.96  |  Unit 7  •  Operating System

15. What does process control block contain? 22. Consider the following code:
(A) Process Identification if (fork( ) == 0)
(B) Process state information {
(C) Process control information a = a + 5;
(D) All of the above printf(“%d,%d\n”,a,&a);
16. Match the following }
else
(i) Multiprogramming (x) Managing multiple pro- {
cesses executing on multiple
a = a – 5;
computers
printf(“%d,%d\n”,a,&a);
(ii) Multiprocessing (y) Management of multiple pro-
cesses within a uniprocessor
}
system. Let p, q be the values printed by the parent process, and

(iii) Distributed process (z) Management of multi- s, t be the values printed by the child process. Which
Management ple processes within a one of the following is true?
multiprocessor.
(A) p = s + 10 and q = t
(A) (i) –y (ii) –z (iii) –x (B) p = s + 10 and q ≠ t
(B) (i) –z (ii) –x (iii) –y (C) p + 10 = s and q = t
(C) (i) –y (ii) –x (iii) –z (D) p + 10 = s and q ≠ t
(D) Ambiguous 23. Consider the following statements with respect to user-
17. For ‘n’ number of fork( ) system call, how many parent level threads:
and child processes will be created? (i) Context switch is faster with kernel-supported
(A) 1, 2n – 1, respectively threads.
(B) 1, 2n, respectively (ii) For user-level threads, a system call can block the
(C) 2n – 1, 1, respectively entire process.
(D) n, 2n, respectively (iii) 
Kernel-supported threads can be scheduled
independently.
18. If the value of binary semaphore is initialized with (iv) User-level threads are transparent to the Kernel.
1 and three wait( ) operations are performed, how many
processes are there in the block list? Which of the above statements are true?
(A) 1 (B) 0 (A) (i), (iii) and (iv) only
(C) 3 (D) 2 (B) (ii) and (iii) only
(C) (i) and (iii) only
19. A counting semaphore is initialized with the value 3.
(D) (i) and (ii) only
A list of ‘P’ and ‘V’ operations are performed on the
semaphore as: 1P, 2V, 2P, 3V, 5P, 7V, 2P, 3V. 24. Suppose there are ‘n’ CPUs and ‘m’ processes such that
The final value of semaphore is? m > n. What will be the minimum and maximum num-
(A) 5 (B) 8 ber of ready, running and blocked process, respectively?
(C) 7 (D) 6 (A) 0, 0, 0 and m, n, m (B) 1, m, 1 and n, n, n
20. The final value of semaphore after 10 ‘P’ operations
(C) m, 1, 0 and m, m, n (D) 0, 0, 0 and n, m, m
and 23 ‘V’ operations is 1. What will be the initial value 25. Consider the following signal semaphore code signal
of this counting semaphore? (semaphore *s)
(A) –14 (B) –13 {
(C) –12 (D) –11 s.value++;
21. For a machine-instruction approach to enforce mutual if( ____(I)____ )
exclusion, following are its properties: {
(i) starvation and deadlock free remove a process P from S.list;
(ii) it is applicable to any number of processes. ____(II)____
(iii) it can be used to support multiple critical sections, }
each defined by its own variable. }
(iv) it is simple, easy to verify and employed with busy
Choose the suitable options for (I) and (II), respectively
waiting
(A) S.value = 0 and wakeup(P);
Which of the above is false? (B) S.value <= 0 and wakeup(P);
(A) (iv) only (B) (ii), (iii) only (C) S.value <0 and block( );
(C) (i), (ii) only (D) (i) only (D) S.value <= 0 and block( );
Test  |  7.97

26. Consider the methods used by processes P1 and P2 for while(1)


accessing their critical sections whenever needed. The {
initial values of shared Boolean variables S1 and S2 are wait(mutex);
randomly assigned. readcount++;
Method used by P1 if(readcount == 1)
While (S1 = = S2); wait(wrt);
Critical section signal(mutex);
S1 = S2;
_ _ _ _ _
Method used by P2 _ _ _ _ _
While (S1 ! = S2); wait(mutex);
Critical section readcount – –;
S2 = !(S1); if(readcount ==0)
Which of the following statements describes the prop-
signal(wrt); signal(mutex);
erties achieved? }
(A) Mutual exclusion but not progress
mutex and wrt are initialized to 1 and readcount is ini-
(B) Progress only
tialized to 0.
(C) Bounded waiting, progress
(D) Mutual exclusion, progress, bounded waiting 28. Mutual exclusion for readers is attained by
27.
Consider the following statements regarding spin locks: (A) Wrt
(i) No context switch is required when a process wait (B) Mutex
on a lock (C) Readcount
(ii) Spin locks are useful when locks are expected to (D) Both (A) and (B)
be held for short times. 29. Which of the following semaphore or semaphores is
(iii) They are often employed on multiprocessor systems used by the first or last reader that enters or exits the
(iv) Process ‘spins’ while waiting for a lock critical section?
Choose the correct option: (A) Wrt
(A) (i), (ii), (iii), (iv) are true (B) Mutex
(B) Only (i) and (ii) are true (C) Readcount
(C) (iii) is false (D) Both (A) and (B)
(D) (ii) is true and (iv) is false 30. The readcount variable keeps track of how many pro-
Common data for questions 28, 29 and 30: From the cesses are ______.
Readers-Writers problem, the data structure for reader pro- (A) Currently reading the object
cess is: (B) Currently writing the object
semaphore mutex, wrt; (C) Waiting in the queue
int readcount; (D) Reading the shared data

Answer Keys

1. C 2. A 3. B 4. D 5. B 6. A 7. C 8. A 9. C 10. B
11. D 12. D 13. A 14. B 15. D 16. A 17. A 18. D 19. B 20. C
21. D 22. D 23. B 24. A 25. B 26. A 27. A 28. B 29. A 30. A

You might also like