Skip to main content

Operating System MCQs with Answers

Practice important Operating System MCQs with answers and explanations.

Chapter: 20
Q501:
Which condition does the critical section problem require to avoid two processes entering simultaneously?
A. bounded waiting
B. mutual exclusion
C. progress
D. deadlock
Correct Answer: B
Chapter: 20
Q502:
In Algorithm 3, when a process exits the critical section, it sets _______.
A. flag[i]=true
B. turn=j
C. flag[i]=false
D. choosing[i]=true
Correct Answer: C
Chapter: 20
Q503:
In Algorithm 3, what happens if both processes attempt to set the ‘turn’ at the same time?
A. Only one setting will persist
B. System crashes
C. Both are allowed
D. Both wait indefinitely
Correct Answer: A
Chapter: 20
Q504:
The Bakery Algorithm mainly solves the critical section problem for how many processes?
A. 2
B. n
C. 1
Correct Answer: B
Chapter: 21
Q505:
What does disabling interrupts ensure in a uniprocessor environment?
A. Increased delay
B. No unexpected modification of shared variables
C. Faster network communication
D. None of the above
Correct Answer: B
Chapter: 21
Q506:
Why is disabling interrupts not feasible in a multiprocessing environment?
A. It improves efficiency
B. It causes time-consuming delays
C. It enhances mutual exclusion
D. It speeds up memory access
Correct Answer: B
Chapter: 21
Q507:
Which machine instruction saves the current value, sets it to true, and returns the saved value?
A. Swap
B. Copy
C. TestAndSet
D. FetchAndAdd
Correct Answer: C
Chapter: 21
Q508:
TestAndSet instruction is executed ________.
A. randomly
B. atomically
C. partially
D. sequentially without guarantee
Correct Answer: B
Chapter: 21
Q509:
In the TSL-based solution, what happens after entering the critical section?
A. lock remains true
B. lock becomes false
C. key is set to true
D. Swap occurs
Correct Answer: B
Chapter: 21
Q510:
What is missing in the TSL-based solution despite satisfying mutual exclusion and progress?
A. Atomic execution
B. Bounded waiting
C. Multiprocessing
D. Swap function
Correct Answer: B
Chapter: 21
Q511:
In the Swap instruction, what happens first?
A. Memory lock
B. Values are compared
C. Values are swapped
D. lock is set true
Correct Answer: C
Chapter: 21
Q512:
In Swap-based mutual exclusion, each process has a local variable called ______.
A. gate
B. lock
C. key
D. switch
Correct Answer: C
Chapter: 21
Q513:
In Swap-based solution, what is initialized to false globally?
A. key
B. lock
C. temp
D. status
Correct Answer: B
Chapter: 21
Q514:
Which two hardware instructions are discussed to solve the critical section problem?
A. Load and Store
B. TestAndSet and Swap
C. Swap and Load
D. Read and Write
Correct Answer: B
Chapter: 21
Q515:
The TestAndSet instruction performs which two actions atomically?
A. Write and delete
B. Save and set
C. Swap and check
D. Load and clear
Correct Answer: B
Chapter: 21
Q516:
The Swap instruction swaps the values of two ______ variables.
A. integer
B. boolean
C. float
D. character
Correct Answer: B
Chapter: 21
Q517:
Which of the following is NOT achieved by the TestAndSet based solution?
A. Mutual exclusion
B. Progress
C. Bounded waiting
D. Atomicity
Correct Answer: C
Chapter: 21
Q518:
In the TestAndSet function, what is returned?
A. New value of target
B. Saved value of target
C. Reference of target
D. NULL
Correct Answer: B
Chapter: 21
Q519:
TestAndSet and Swap are examples of ________ hardware instructions.
A. synchronized
B. asynchronous
C. atomic
D. random
Correct Answer: C
Chapter: 21
Q520:
After executing the Swap function, what happens to 'a'?
A. It holds the value of 'b'
B. It holds the value of 'temp'
C. It remains unchanged
D. It gets a new random value
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Operating System

🚀 Start Quiz Now