

MCQOPTIONS
Saved Bookmarks
This section includes 130 Mcqs, each offering curated multiple-choice questions to sharpen your OPERATING SYSTEMS knowledge and support exam preparation. Choose a topic below to get started.
1. |
Consider the following two-process synchronization solution: Process 0 Process 1 Entry: loop while (turn = = 1); Entry: loop while (turn = = 0); (critical section) (critical section) Exit: turn =1; Exit: turn = 0; The shared variable turn is initialized to zero. Which one of the following is TRUE ? |
A. | This is a correct two-process synchronization solution. |
B. | This solution violates mutual exclusion requirement. |
C. | This solution violates progress requirement. |
D. | This solution violates bounded wait requirement. |
Answer» D. This solution violates bounded wait requirement. | |
2. |
Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1; ...,Ok}. This is done in the following manner: Step 1. T acquires exclusive locks to O1,..., Ok in increasing order of their addresses. Step 2. The required operations are performed. Step 3. All locks are released. This protocol will |
A. | guarantee serializability and deadlock-freedom |
B. | guarantee neither serializability nor deadlock-freedom |
C. | guarantee serializability but not deadlock-freedom |
D. | guarantee deadlock-freedom but not serializability |
Answer» B. guarantee neither serializability nor deadlock-freedom | |
3. |
Consider the following proposed solution for the critical section problem. There are n processes: P0 ...Pn - 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero. Code for Pi: do { c[i] = 1; t[i] = pmax (t[0],..., t[n 1]) + 1; c[i] = 0; for every j i in{0,..., n 1} { while(c[j]); while(t[j] != 0 && t[j] |
A. | At most one process can be in the critical section at any time. |
B. | The bounded wait condition is satisfied. |
C. | The progress condition is satisfied. |
D. | It cannot cause a deadlock. |
Answer» B. The bounded wait condition is satisfied. | |
4. |
The enter _CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows void enter_CS(X) { while (test-and-sex (X)); } void leave_CS(X) { X = 0; } In the above solution, X is a memory location associated with the CS and is initialized to 0. Now, consider the following statements : 1. The above solution to CS problem is deadlock-free. 2. The solution is starvation-free. 3. The processes enter CS in FIFO order. 4. More than one processes can enter CS at the same time.Which of the above statements is true? |
A. | 1 only |
B. | 1 and 2 |
C. | 2 and 3 |
D. | 4 only |
Answer» B. 1 and 2 | |
5. |
The P and V operations on counting semaphores, where s is a counting semaphore, and defined as follows P(s): s = s 1; if s < 0 then wait; V(s): s = s + 1; if s < = 0 then we ke up a process waiting on s; Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores Xb and Yb are used to implement the semaphore operations P(s) and V(s) as follows P(s): Pb (Xb); s = s 1; if (s < 0) { Vb (Xb); Pb (Yb); } else Vb (Xb); V(s): Pb (Yb); s = s + 1; if (s < = 0) Vb (Yb); Vb (Xb); The initial values of Xb and Yb are respectively |
A. | 0 and 0 |
B. | 0 and 1 |
C. | 1 and 0 |
D. | 1 and 1 |
Answer» D. 1 and 1 | |
6. |
Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes Process X /* other code for process X */while (true) { varP = true; while (varQ == true) { /* critical section */ varP = false; } } /* other code for process X */ Process Y /* other code for process Y */ while (true) { varQ = true; while (varP == true) { /* critical section */ varQ = false; } } /* other code for process Y */ Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true? |
A. | The proposed solution prevents deadlock but fails to guarantee mutual exclusion |
B. | The proposed solution guarantees mutual exclusion but fails to prevent deadlock |
C. | The proposed solution guarantees mutual exclusion and prevents deadlock |
D. | The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion |
Answer» B. The proposed solution guarantees mutual exclusion but fails to prevent deadlock | |
7. |
Consider the intermediate code given below. (1) i = 1 (2) j = 1 (3) t1 = 5 * i (4) t2 = t1 + j (5) t3 = 4 * t2 (6) t4 = t3 (7) a[t4] = 1 (8) j = j + 1 (9) if j < = 5 goto (3) (10) i = i + 1 (11) if i < 5 goto (2)The number of nodes and edges in the control-flow-graph constructed for the above code, respectively, are |
A. | 5 and 7 |
B. | 6 and 7 |
C. | 5 and 5 |
D. | 7 and 8 |
Answer» C. 5 and 5 | |
8. |
Which of the following will ensure that the output string never contains a substring of the form 01n 0 or 10n1 where n is odd? |
A. | P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1 |
B. | P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1 |
C. | P(S) at W, V(S) at X, P(S) at Y, V(S) at Z, S initially 1 |
D. | V(S) at W, V(T) at X, P(S) at Y, P(T) at Z, S and T initially 1 |
Answer» D. V(S) at W, V(T) at X, P(S) at Y, P(T) at Z, S and T initially 1 | |
9. |
Two processes P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes :/* P1 *//* P2 */while (true) { while (true){ wants1 = true; wants2 = true; while while (wants 1 = = true); (wants2 = = true); /* Critical /* Critical Section */ Section */ wants2 = false; wants1 = false; } /* Remainder section */ } (/* Remainder Section) Here, wants1 and wants2 are shared variables, which are initialized to false, Which one of the following statements is true about the above construct? |
A. | it does not ensure mutual exclusion |
B. | it does not ensure bounded waiting |
C. | it requires that processes enter the critical section in strict alternation |
D. | it does not prevent deadlocks, but ensures mutual exclusion |
Answer» E. | |
10. |
Consider the following policies for preventing deadlock in a system with mutually exclusive resources.i. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released. ii. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers iii. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers iv. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources Which of the above policies can be used for preventing deadlock? |
A. | Any one of i and iii but not ii or iv |
B. | Any one of i, iii, and iv but not ii |
C. | Any one of ii, and iii but not i or iv |
D. | Any one of i, ii, iii, and iv |
Answer» E. | |
11. |
Suppose n processes, p1, p2..., pn share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process Pi is si, where Si > 0. Which one of the following is a sufficient condition for ensuring that deadlock does not occur? |
A. | i , s |
B. | < m |
C. | i , s |
D. | < n |
Answer» D. < n | |
12. |
Consider a uni processor system executing three tasks T1, T2 and T3, each o which is composed of an infinite sequence of jobs (or instances) which arrive periodically at intervals of 3, 7 and 20 milliseconds, respectively. The priority of each task is the inverse of its period, and the available tasks are scheduled in order of priority, with the highest priority task scheduled first. Each instance of T1, T2 and T3 requires an execution time of 1, 2 and 4 milliseconds, respectively. Given that all tasks initially arrive at the beginning of the 1st millisecond and task preemptions are allowed, the first instance of T3 completes its execution at the end of ______ milliseconds. |
A. | 23 |
B. | 7 |
C. | 21 |
Answer» C. 21 | |
13. |
Consider the set of processes with arrival time (in milliseconds). CPU burst time (in milliseconds) and priority (0 is the highest priority) shown below. None of the processes have I/O burst time. Process Arrival Time Burst Time Priority P1 0 11 2 P2 5 28 0 P3 12 2 3 P4 2 10 1 P5 9 164 The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is ________. |
A. | 9 ms |
B. | 11 ms |
C. | 19 ms |
D. | 29 ms |
Answer» E. | |
14. |
The following are the starting and ending times of activities A, B, C, D, E, F, G and H respectively in chronological order: as bs cs ae ds ce es fs be de gs ee fe hs ge he. Here, xs denotes the starting time and xe denotes the ending time of activity X. We need to schedule the activities in a set of rooms available to us. An activity can be scheduled in a room only if the room is reserved for the activity for its entire duration. What is the minimum number of rooms required? |
A. | 3 |
B. | 4 |
C. | 5 |
D. | 6 |
Answer» C. 5 | |
15. |
Consider a set of n tasks with known runtimes r1, r2, ...rn to be run on a uniprocessor machine. Which of the following processor scheduling algorithms will result in the maximum throughput? |
A. | Round Robin |
B. | Shortes Jobs First |
C. | Highest Response Ratio Next |
D. | First Come First Served |
Answer» C. Highest Response Ratio Next | |
16. |
Recall that Belady s anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements: SI: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady s anomaly S2: LRU page replacement algorithm suffers from Belady s anomaly Which of the following is CORRECT? |
A. | S1 is true, S2 is true |
B. | S1 is true, S2 is false |
C. | S1 is false. S2 is true |
D. | SI is false. S2 is false |
Answer» C. S1 is false. S2 is true | |
17. |
A system uses 3 page frames for storing process pages in main memory. It uses the Least Recently Used (LRU) page replacement policy. Assume that all the page frames are initially empty. What is the total number of page faults that will occur while processing the page reference string given below? 4, 7, 6, 1, 7, 6, 1, 2, 7, 2 |
A. | 3 |
B. | 6 |
C. | 9 |
D. | 15 |
Answer» C. 9 | |
18. |
Consider a computer system with ten physical page frames. The system is provided with an access sequence (a1, a2 ,..., a20, a1, a2,..., a20), where each ai is a distinct virtual page number. The difference in the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is _________. |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» B. 2 | |
19. |
Fetch_And_Add (X, i) is an atomic Read-Modify-Write instruction that reads the value of memory location X, increments it by the value i and returns the old value of X. It is used in the pseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variable initialized to 0. The value of 0 corresponds to lock being available, while any non-zero value corresponds to the lock being not available.AcquireLock (L) { while (Fetch_And_Add (L, 1)) L = 1; } ReleaseLock (L) { L = 0 } This implementation |
A. | fails as L can overflow |
B. | fails as L can take on a non-zero value that lock is actually available |
C. | works correctly but may starve some processes |
D. | works correctly without starvation |
Answer» C. works correctly but may starve some processes | |
20. |
Which of the following statements are true? I. Shortest remaining time first scheduling may cause starvation. II. Pre-emptive scheduling may cause starvation.II. Pre-emptive scheduling may cause starvation. III. Round robin is better than FCFS in terms of response time |
A. | I only |
B. | I and III |
C. | II and III |
D. | I, II and III |
Answer» E. | |
21. |
Consider the following table of arrival time and burst time for three processes P0, P1 and P2. Process Arrival time Burst time P0 0 ms 9 ms P1 1 ms 4 ms P2 2 ms 9 ms The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes? |
A. | 5.0 ms |
B. | 4.33 ms |
C. | 6.33 ms |
D. | 7.33 ms |
Answer» B. 4.33 ms | |
22. |
Three processes A, B and C each execute a loop of 100 iterations. In each iteration of the loop, a process performs a single computation that requires tC CPU milliseconds and then initiates a single I/O operation that lasts for tio milliseconds. It is assumed that the computer where the processes execute has sufficient number of I/O devices and the OS of the computer assigns different I/O devices to each process. Also, the scheduling overhead of the OS is negligible. The processes have the following characteristics : Process id tc tio A 100 ms 500 ms B 350 ms 500 ms C 200 ms 500 ms The processes A, B, and C are started at times 0, 5 and 10 milliseconds respectively, in a pure time sharing system (round robin scheduling) that uses a time slice of 50 milliseconds. The time in milliseconds at which process C would complete its first I/O operation is ___________. |
A. | 10 |
B. | 100 |
C. | 1000 |
D. | 500 |
Answer» D. 500 | |
23. |
A system has n resources R0, ..... Rn - 1, and k processes P0, .... Pk - 1. The implementation of the resources request logic of each process Pi, is as follows if (i% 2 = = 0) { if (i < n) request Ri; if (i + 2 < n) request Ri + 2; } else { if (i < n) request Rn - i; if (i + 2 < n) request Rn - i - 2; } In which one of the following situations is a deadlock possible? |
A. | n = 40, k = 26 |
B. | n = 21, k = 12 |
C. | n = 20, k = 10 |
D. | n = 41, k = 19 |
Answer» C. n = 20, k = 10 | |
24. |
A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below: Process Current Allocation MaximumRequirement P1 3 7 P2 1 6 P3 3 5 Which of the following best describes current state of the system? |
A. | Safe, Deadlocked |
B. | Safe, Not Deadlocked |
C. | Not Safe, Deadlocked |
D. | Not Safe, Not Deadlocked |
Answer» C. Not Safe, Deadlocked | |
25. |
Consider Peterson s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below. repeat flag [i] = true; turn = j; while (P) do no-op; Enter critical section, perform actions, then exit critical section Flag [i] = false; Perform other non-critical section actions. Until false; For the program to guarantee mutual exclusion, the predicate P in the while loop should be |
A. | flag [j] = true and turn = i |
B. | flag [j] = true and turn = j |
C. | flag [j] = true and turn = j |
D. | flag [j] = true and turn = i |
Answer» C. flag [j] = true and turn = j | |
26. |
A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed number of frames to a process. Consider the following statements: P : Increasing the number of page frames allocated to a process sometimes increases the page fault rate. Q : Some programs do not exhibit locality of reference. Which one of the following is true? |
A. | Both P and Q are true, and Q is the reason for P |
B. | Both P and Q are true, and Q is not the reason for P |
C. | P is false but Q is true |
D. | Both P and Q are false |
Answer» C. P is false but Q is true | |
27. |
A computer handles several interrupt sources of which of the following are relevant for this question? Interrupt from CPU temperature sensor Interrupt from Mouse Interrupt from Keyboard Interrupt from Hard Disk |
A. | Interrupt from Hard Disk |
B. | Interrupt from Mouse |
C. | Interrupt from Keyboard |
D. | Interrupt from CPU temp sensor |
Answer» E. | |
28. |
A process uses 36 bit physical addresses and 32 bit virtual addresses, with a page frame size of 4 kbyte. Each page table entry is of size 4 byte. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows Bit 30-31 are used to index into the first level page table Bit 21-29 are used to index into the second level page table Bit 12-20 are used to index into the third level page table,and Bit 0-11 are used as offset within the page The number of bits required for addressing the next level page table (or page frame) in the page table entry of the first, second and third level page tables are respectively |
A. | 20, 20 and 20 |
B. | 24, 24 and 24 |
C. | 24, 24 and 20 |
D. | 25, 25 and 24 |
Answer» E. | |
29. |
The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x in y without allowing any intervening access to the memory location x. Consider the following implementation of P and V functions on a binary semaphore S. void P (binary_semaphore *S) { unsigned y;unsigned *x = & (S -> value); do { fetch-and-set x, y; } while (y); } void V (binary_semaphore *S) { s - > value = 0; } Which one of the following is true? |
A. | The implementation may not work, if context switching is disabled in P |
B. | Instead of using fetch-and-set, a pair of normal load/ store can be used |
C. | The implementation of V is wrong |
D. | The code does not implement a binary semaphore |
Answer» B. Instead of using fetch-and-set, a pair of normal load/ store can be used | |
30. |
Least Recently Used (LRU) page replacement policy is a practical approximation to optimal page replacement. For the above reference string, how many more page faults occurwith LRU than with the optimal page replacement policy? |
A. | zero |
B. | 1 |
C. | 2 |
D. | 3 |
Answer» D. 3 | |
31. |
Which combination of the following features will suffice to characterize an operating system as a multi-programmed operating system? (A) More than one programs may be loaded into main memory at the same time for execution. (B) If a program waits for certain events such as IN/ OUT, another program is immediately scheduled for execution. (C) If the execution of a program terminates, another program is immediately scheduled for execution. |
A. | (A) only |
B. | (A) and (B) |
C. | (A) and (C) |
D. | (A), (B) and (C) |
Answer» C. (A) and (C) | |
32. |
Consider the following statements about user level threads and kernel level threads : Which one of the following statements if false? |
A. | Context switch time is longer for kernel level threads than for user level threads |
B. | User level threads do not need any hardware support |
C. | Related kernel level threads can be scheduled on different processors in a multi-processor system |
D. | Blocking one kernel level thread blocks all related threads |
Answer» E. | |
33. |
Consider the following statements with respect to userlevel threads and kernel-supported threads: 1. Context switch is faster with kernel-supported threads 2. for user-level threads, a system call can block the entire process 3. Kernel supported threads can be scheduled independently 4. User level threads are transparent to the kernel Which of the above statements are true? |
A. | 2, 3 and 4 |
B. | 2 and 3 |
C. | 1 and 3 |
D. | 1 and 2 |
Answer» B. 2 and 3 | |
34. |
Consider the following code fragment : if (fork () = =) {a = a + 5, print f ( %d, %d n , a, &a),} else {a = a 5, print f ( %d, %d n , a, &a),} Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is true? |
A. | u = x + 10 and v = y |
B. | u = x + 1 and v y |
C. | u + 10 = x and v = y |
D. | u + 10 = x and v y |
Answer» D. u + 10 = x and v y | |
35. |
Consider the following code segment : x = u t; y = x * v; x = y + w;y = t z; y = x * y; The minimum number of total variables required to convert the above code segment to static single assignment form is __________. |
A. | 5 |
B. | 10 |
C. | 100 |
D. | 11 |
Answer» C. 100 | |
36. |
Which of the following is/are shared by all the threads in a process? I. Program counter II. Stack III. Address space IV. Registers |
A. | I and II only |
B. | III only |
C. | IV only |
D. | III and IV only |
Answer» C. IV only | |
37. |
Which one of the following is FALSE ? |
A. | User level threads are not scheduled by the kernel. |
B. | When a user level thread is blocked, all other threads of its process are blocked. |
C. | Context switching between user level threads is faster than context switching between kernel level threads. |
D. | Kernel level threads cannot share the code segment. |
Answer» E. | |
38. |
A process executes the code fork (); fork (); fork (); The total number of child processes created is |
A. | 3 |
B. | 4 |
C. | 7 |
D. | 8 |
Answer» D. 8 | |
39. |
In a file allocation system, which of the following allocation scheme(s) can be used if no external fragmentation is allowed?I. Contiguous II. Linked III. Indexed |
A. | I and III only |
B. | II only |
C. | III only |
D. | II and III only |
Answer» E. | |
40. |
Suppose a process has only the following pages in its virtual address space: two contiguous code pages starting at virtual address 0 00000000, two contiguous data pages starting at virtual address 0 00400000, and a stack page starting at virtual address 0 FFFFF000. The amount of memory required for storing the page tables of this process is |
A. | 8 kbyte |
B. | 12 kbyte |
C. | 16 kbyte |
D. | 20 kbyte |
Answer» D. 20 kbyte | |
41. |
Assuming that no page faults occur, the average time taken to access a virtual address is approximately (to the nearest 0.5 ns) |
A. | 1.5 ns |
B. | 2 ns |
C. | 3 ns |
D. | 4 ns |
Answer» E. | |
42. |
In a system with 32 bit virtual addresses and 1 kbyte page size, use of one-level page tables for virtual to physical address translation is not practical because of |
A. | the large amount of internal fragmentation |
B. | the large amount of external fragmentation |
C. | the large memory overhead in maintaining page tables |
D. | the large computation overhead in the translation process |
Answer» D. the large computation overhead in the translation process | |
43. |
A CPU generates 32-bit virtual addresses. The page size is 4 kbyte. The processor has a transition look-aside buffer (TLB) which can hold a total of 128 page table entries and is 4-way set associative. The minimum size of the TLB tag is |
A. | 11 bit |
B. | 13 bit |
C. | 15 bit |
D. | 20 bit |
Answer» D. 20 bit | |
44. |
A computer system supports 32-bit virtual addresses as well as 32-bit physical addresses. Since, the virtual address space is of the same size as the physical address space, the operating system designers decide to get rid of the virtual memory entirely. Which one of the following is true? |
A. | Efficient implementation of multi-user support is no longer possible |
B. | The processor cache organization can be made more efficient now |
C. | Hardware support for memory management is no longer needed |
D. | CPU scheduling can be made more efficient now |
Answer» B. The processor cache organization can be made more efficient now | |
45. |
A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed number of frames to a process. Consider the following statements: |
A. | Both P and Q are true, and Q is the reason for P |
B. | Both P and Q are true, and Q is not the reason for P |
C. | P is false but Q is true |
D. | Both P and Q are false |
Answer» C. P is false but Q is true | |
46. |
A process uses 36 bit physical addresses and 32 bit virtual addresses, with a page frame size of 4 kbyte. Each page table entry is of size 4 byte. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows |
A. | 20, 20 and 20 |
B. | 24, 24 and 24 |
C. | 24, 24 and 20 |
D. | 25, 25 and 24 |
Answer» E. | |
47. |
Which of the following statements about synchronous and asynchronous IN/OUT is not true? |
A. | An ISR is invoked on completion of IN/OUT in synchronous IN/OUT but not in asynchronous IN/OUT |
B. | In both synchronous and asynchronous IN/OUT, an ISR (Interrupt Service Routine) is involved after completion of the In/OUT |
C. | A process making a synchronous IN/OUT call waits until IN/OUT is complete, but a process making an asynchronous IN/OUT call does not wait for completion of the IN/OUT |
D. | In the case of synchronous IN/OUT, the process waiting for the completion of IN/OUT is woken up by the ISR that is invoked after the completion of IN/ OUT |
Answer» C. A process making a synchronous IN/OUT call waits until IN/OUT is complete, but a process making an asynchronous IN/OUT call does not wait for completion of the IN/OUT | |
48. |
The data blocks of a very large file in the Unix file system are allocated using |
A. | contiguous allocation |
B. | linked allocation |
C. | indexed allocation |
D. | an extension of indexed allocation |
Answer» E. | |
49. |
The essential content(s) in each entry of a page table is/are |
A. | virtual page number |
B. | page frame number |
C. | both virtual number and page frame number |
D. | access right information |
Answer» C. both virtual number and page frame number | |
50. |
A computer handles several interrupt sources of which of the following are relevant for this question? |
A. | Interrupt from Hard Disk |
B. | Interrupt from Mouse |
C. | Interrupt from Keyboard |
D. | Interrupt from CPU temp sensor |
Answer» E. | |