Explore topic-wise MCQs in Operating System.

This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your Operating System knowledge and support exam preparation. Choose a topic below to get started.

1.

A counting semaphore was initialized to 7. Then 20 P (wait) operations and x V (signal) operations were completed on this semaphore. If the final value of semaphore is 5, then the value x will be

A. 0
B. 13
C. 18
D. 5
Answer» D. 5
2.

At particular time, the value of a counting semaphore is 10, it will become 7 after

A. 3 V operations
B. 3 P operations
C. 5 V operations and 2 P operations
D. 2 V operations and 6 P operations
Answer» C. 5 V operations and 2 P operations
3.

At a particular time of computation, the value of a counting semaphore is 7. Then 20 P operation and x V operations were completed on this semaphore. If the final value of the semaphore is 5, x will be

A. 18
B. 22
C. 15
D. 13
Answer» B. 22
4.

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 releasedII. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbersIII. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbersIV. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resourcesWhich 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.
5.

In order to allow only one process to enter its critical section, binary semaphore are initialized to

A. 0
B. 1
C. 2
D. 3
Answer» C. 2
6.

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]<=t[i]) ; ] Critical section; t[i] =0; Remainder Section;} While (true);Which one of the following is TRUE about the above solution?

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
7.

At a particular time of computation the value of a counting semaphore is 7. Then 20 P operations and 15 V operation were completed on this semaphore. The resulting value of the semaphore is

A. 42
B. 2
C. 7
D. 12
Answer» C. 7
8.

Each of a set of n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.CODE SECTION Pwait (a); count=count+1 ;if (count==n) signal (b) ;signal (a) ; wait (b) ; signal (b) ;CODE SECTION QWhat does the code achieve?

A. It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.
B. It ensures that at most two processes are in CODE SECTION Q at any time.
C. It ensures that all processes execute CODE SECTION P mutually exclusively.
D. It ensures that at most n-1 processes are in CODE SECTION P at any time.
Answer» B. It ensures that at most two processes are in CODE SECTION Q at any time.
9.

Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is

A. P: full, Q: full, R: empty, S: empty
B. P: empty, Q: empty, R: full, S: full
C. P: full, Q: empty, R: empty, S: full
D. P: empty, Q: full, R: full, S: empty
Answer» D. P: empty, Q: full, R: full, S: empty
10.

In mass storage devices __________ is process of rearranging/relocating many small non-contiguous blocks of data, into fewer contiguous big-sized blocks.

A. Defragmentation
B. Paging
C. Booting
D. Restoring
Answer» B. Paging
11.

A certain computation generates two arrays a and b such that a[i]=f(i) for 0 ≤ i < n and b[i] = g (a[i] ) for 0 ≤ i < n. Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array a and Y computes the array b. The processes employ two binary semaphores R and S, both initialized to zero. The array a is shared by the two processes. The structures of the processes are shown below.Process X:private i;for (i=0; i a[i] = f(i); ExitX(R, S);}Process Y:private i;for (i=0; i EntryY(R, S); b[i] = g(a[i]);}Which one of the following represents the CORRECT implementations of ExitX and EntryY?

A. ExitX(R, S) {P(R);V(S);}EntryY(R, S) {P(S);V(R);}
B. ExitX(R, S) { V(R); V(S);}EntryY(R, S) { P(R); P(S);}
C. ExitX(R, S) { P(S); V(R);}EntryY(R, S) { V(S); P(R);}
D. ExitX(R, S) { V(R); P(S);}EntryY(R, S) { V(S); P(R);}
Answer» D. ExitX(R, S) { V(R); P(S);}EntryY(R, S) { V(S); P(R);}