Q: 1 Consider a system with 3 processes P0 to P2 and 3 resources types A, B and C. Resource type A has 10 instances, resource type B has 5 instances and resource type C has 7 instances. The following snapshot of the system has been taken at a given time.
| Allocation | Max | Available | |||||||
|---|---|---|---|---|---|---|---|---|---|
| A | B | C | A | B | C | A | B | C | |
| P0 | 0 | 1 | 0 | 7 | 5 | 3 | 5 | 4 | 5 |
| P1 | 2 | 0 | 0 | 3 | 2 | 2 | |||
| P2 | 3 | 0 | 2 | 9 | 0 | 2 | |||
Which of the following is true?
The system is not in safe state
The system is blocked
The system is in safe state
The request cannot be granted to all the processes
[ Option C ]
The Banker’s Algorithm is used in operating systems to avoid deadlock by checking whether the system is in a safe state before allocating resources. A system is said to be in a safe state if there exists a safe sequence of processes such that each process can obtain its required resources, execute, and release the resources without causing deadlock.
To determine this, we calculate the Need matrix using, Need = Max-Allocation and then check whether each process's Need ≤ Available resources.
Compute Need :
Need = Max – Allocation
| Process | Allocation (A B C) | Max (A B C) | Need (A B C) |
|---|---|---|---|
| P0 | 0 1 0 | 7 5 3 | 7 4 3 |
| P1 | 2 0 0 | 3 2 2 | 1 2 2 |
| P2 | 3 0 2 | 9 0 2 | 6 0 0 |
Available = (5, 4, 5)
Thus, a safe sequence exists: P1→P0→P2. Since a safe sequence is found, the system is in a safe state.
Q: 2 Which of the following is a scheme for deadlock avoidance?
Manipulate to find at least one safe path
Requesting all resources at once and keep other task waiting
Pre-emption
Resource ordering
[ Option A ]
Deadlock Avoidance is a method used by an operating system to ensure that a system never enters a deadlock state. In deadlock avoidance, the OS makes decisions dynamically by checking whether allocating a requested resource will keep the system in a safe state.
A safe state means that there is at least one sequence in which all processes can complete their execution without getting stuck waiting for each other. The Banker’s Algorithm is a well-known example of deadlock avoidance that works by finding at least one safe sequence before granting a request.
Q: 3 Consider the resource allocation graph. “This system is always in deadlock state.” This remark is :

True
False
Unpredictable
Impossible to determine
[ Option B ]
The given resource allocation graph shows two resources, R₁ and R₂, each having two instances, and four processes, T₁, T₂, T₃, and T₄. In this graph, T₁ is waiting for an instance of R₁, while T₂ and T₃ are already holding instances of R₁. Similarly, T₄ is holding an instance of R₂, and T₁ is requesting it.
Since both resources have multiple instances available, all processes can still be allocated resources without creating a circular wait. Therefore, the system is not always in a deadlock state, and the statement that it is always in deadlock is false.
Q: 4 Consider a system with five processes P0 to P4 and three resource types A, B, C. suppose that, at time T0, the following snapshot of the system has been taken:
| Allocation | Need | Available | |
|---|---|---|---|
| ABC | ABC | ABC | |
| P0 | 010 | 743 | 230 |
| P1 | 302 | 020 | |
| P2 | 302 | 600 | |
| P3 | 211 | 011 | |
| P4 | 002 | 431 |
Check whether a request for (0,2,0) by P0 can be granted according to Banker’s Algorithm?
Yes (Request can be granted)
No (Request cannot be granted)
Cannot be decided
Resulting state is safe
[ Option B ]
Banker’s Algorithm is used in operating systems to avoid deadlock by ensuring that resource allocation keeps the system in a safe state.
Steps to check if a request can be granted:
Q: 5 Which of the following is not a necessary condition for deadlock?
Hold & wait
No pre-emption
Starvation
Circular wait
[ Option C ]
In Operating Systems, a deadlock occurs when a set of processes are permanently blocked because each process is waiting for a resource held by another process.
There are four necessary conditions for deadlock (Coffman Conditions):
| CONDITION | DESCRIPTION |
|---|---|
| Mutual Exclusion | At least one resource must be non-shareable means only one process can use it at a time. |
| Hold and Wait | A process holding at least one resource is waiting to acquire additional resources held by other processes. |
| No Pre-emption | Resources cannot be forcibly taken from a process. They must be released voluntarily. |
| Circular Wait | A circular chain of processes exists where each process waits for a resource held by the next process in the cycle. |
On the other hand, Starvation means, a process waits indefinitely because other processes continuously get the required resources.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.