Explore topic-wise MCQs in Operating System.

This section includes 17 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.

An operating system contains 3 user processes each requiring 2 units of resource R. The minimum number of units of such that no deadlock will ever occur is:

A. 2
B. 4
C. 3
D. 5
Answer» C. 3
2.

A system has 6 identical resources and N processes competing for them. Each process can request at most 2 resources. Which one of the following values of N could lead to a deadlock?

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

Consider the following two-process synchronization solution.Process 0- - - - - - - -Entry: loop while (turn == 1); (critical section)Exit: turn = 1;Process 1- - - - - - - -Entry: loop while (turn == 0); (critical section)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.
4.

Consider the procedure below for the Producer-Consumer problem which uses semaphores:semaphore n = 0;semaphore s = 1; void producer(){while(true){produce();semWait(s);addToBuffer();semSignal(s);semSignal(n);}} void consumer(){ while(true) { semWait(s); semWait(n); removeFromBuffer(); semSignal(s); consume(); }} Which one of the following is TRUE?

A. The producer will be able to add an item to the buffer, but the consumer can never consume it.
B. The consumer will remove no more than one item from the buffer.
C. Deadlock occurs if the consumer succeeds in acquiring semaphore s when the buffer is empty.
D. The starting value for the semaphore n must be 1 and not 0 for deadlock-free operation.
Answer» D. The starting value for the semaphore n must be 1 and not 0 for deadlock-free operation.
5.

Consider a system having m resources of the same type. These resources are shared by 3 processes A, B, C, which have peak time demands of 3, 4, 6 respectively. The minimum value of m that ensures that deadlock will never occur is

A. 11
B. 12
C. 13
D. 14
Answer» B. 12
6.

An aid to determine the deadlock occurrence is

A. resource allocation graph
B. starvation graph
C. inversion graph
D. none of the above
Answer» B. starvation graph
7.

A multithreaded program P executes with x number of threads used y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-re-entrant. i.e. if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimum value of x and the minimum value of y together for which execution of p can result in a deadlock are:

A. x = 1, y = 2
B. x = 2, y k = 1
C. x = 2, y = 2
D. x = 1, y = 1
Answer» E.
8.

Consider the following snapshot of a system running n concurrent processes. Process i is holding Xi instances of a resource R, 1 ≤ i ≤ n. Assume that all instances of R are currently in use. Further, for all i, process i can place a request for at most Yi additional instances of R while holding the Xi instances it already has. Of the n processes, there are exactly two processes p and q such that Yp = Yq = 0. Which one of the following conditions guarantees that no other process apart from p and q can complete execution?

A. Xp + Xq < Min {Yk | 1 ≤ k ≤ n , k ≠ p, k ≠ q}
B. Xp + Xq < Max {Yk | 1 ≤ k ≤ n , k ≠ p, k ≠ q}
C. Min (Xp ,Xq) ≥ Min {Yk | 1 ≤ k ≤ n , k ≠ p, k ≠ q}
D. Min (Xp, Xq) ≤ Max {Yk | 1 ≤ k ≤ n , k ≠ p, k ≠ q}
Answer» B. Xp + Xq < Max {Yk | 1 ≤ k ≤ n , k ≠ p, k ≠ q}
9.

Given a set of four, two resources with two units, each. The following resources allocation graph exits at a point in time:The graph indicates:

A. Cycle and deadlock
B. No cycle but deadlock
C. Neither cycle nor deadlock
D. Cycle but no deadlock
Answer» E.
10.

An operating system uses the Banker’s algorithm for deadlock avoidance when managing the allocation of three resource types X, Y, and Z to three processes P0, P1, and P2. The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution. AllocationMax XYZXYZP0001843P1320620P2211333 There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is currently in a safe state. Consider the following independent requests for additional resources in the current state:REQ1: P0 requests 0 units of X, 0 units of Y and 2 units of ZREQ2: P1 requests 2 units of X, 0 units of Y and 0 units of ZWhich one of the following is TRUE?

A. Only REQ1 can be permitted
B. Only REQ2 can be permitted.
C. Both REQ1 and REQ2 can be permitted
D. Neither REQ1 nor REQ2 can be permitted
Answer» C. Both REQ1 and REQ2 can be permitted
11.

In a system, there are three types of resources: and . Four processes and execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[ ] is the maximum number of instances of that would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available.Allocation EFGP0101P1112P2103P3200 Max EFGP0431P1214P2133P3541 From the perspective of deadlock avoidance, which one of the following is true?

A. The system is in safe state.
B. The system is not in state, but would be if one more instance of E were available
C. The system is not in safe state, but would be safe if one more instance of F were available
D. The system is not in state, but would be if one more instance of G were available
Answer» B. The system is not in state, but would be if one more instance of E were available
12.

Consider a system with five processes P0, through P4, and three resource types A, B and C. Resource type A has seven instances, resource type B has two instances and resource type C has six instances suppose at time T0 we Have the following allocation.ProcessAllocationRequestAvailable ABCABCABCP0010000000P1200202 P2303000P3211100P4022002 If we implement Deadlock detection algorithm we claim that system is ______.

A. Semaphore
B. Deadlock state
C. Circular wait
D. Not in deadlock state
Answer» E.
13.

A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for three processes are shown below:ProcessCurrent AllocationMaximum RequirementP137P216P335 Which of the following best describes current state of the system?

A. Safe, Deadlocked
B. Safe, Not Deadlocked
C. Note Safe, Deadlocked
D. Not Safe, Not Deadlocked
Answer» C. Note Safe, Deadlocked
14.

Mutual exclusion problem occurs

A. Between two disjoint processes that do not interact
B. Among processes that share resources
C. Among processes that do not use the same resource
D. Between two processes that uses different resources of different machine
Answer» C. Among processes that do not use the same resource
15.

‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚Àւ§M‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•_PROCESSES_SHARE_‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚Àւ§N‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•_RESOURCES_OF_THE_SAME_TYPE._THE_MAXIMUM_NEED_OF_EACH_PROCESS_DOESN‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•T_EXCEED_‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚Àւ§N‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•_AND_THE_SUM_OF_ALL_THEIR_MAXIMUM_NEEDS_IS_ALWAYS_LESS_THAN_M+N._IN_THIS_SETUP,_DEADLOCK_:?$#

A. can never occur
B. may occur
C. has to occur
D. none of the mentioned
Answer» B. may occur
16.

A system has 3 processes sharing 4 resources. If each process needs a maximum of 2 units then, deadlock ?

A. can never occur
B. may occur
C. has to occur
D. none of the mentioned
Answer» B. may occur
17.

A computer system has 6 tape drives, with ‘n’ processes competing for them. Each process may need 3 tape drives. The maximum value of ‘n’ for which the system is guaranteed to be deadlock free is :$

A. 2
B. 3
C. 4
D. 1
Answer» B. 3