Operating Systems MCQs multiple-choice questions with answers & explanations
All 11 Operating Systems quiz questions on one page. Pick an answer in your head, then open Show answer to check it and read why. Want a score and a timer? Take them as a quiz instead.
Official reference: Operating Systems: Three Easy Pieces
- 1.easy
What is a race condition?
- AA result depends on timing of concurrent operations
- BA process always uses one CPU
- CA file cannot be opened
- DA program has no threads
Show answer
Answer: A (A result depends on timing of concurrent operations)
A race condition arises when timing or ordering affects correctness. Coordinating shared state can prevent it.
- 2.easy
Which memory is normally private to each thread?
- AAll global variables
- BIts execution stack
- CEvery heap object
- DThe entire process address space
Show answer
Answer: B (Its execution stack)
Each thread has its own execution stack. Threads in the same process normally share heap and global memory.
- 3.easy
What does a context switch do?
- ACompiles source code
- BSaves and restores execution state
- CDeletes unused files
- DAlways creates a process
Show answer
Answer: B (Saves and restores execution state)
A context switch changes the running execution context by saving and restoring state. It has overhead and does not necessarily create anything.
- 4.easy
What is a mutex primarily used for?
- AIncreasing disk capacity
- BProtecting a critical section from simultaneous access
- CMaking all operations lock-free
- DAssigning IP addresses
Show answer
Answer: B (Protecting a critical section from simultaneous access)
A mutex provides mutual exclusion when participants follow the same locking protocol. It does not automatically protect code that bypasses the lock.
- 5.mid
Which primitive naturally limits concurrent access to a pool of five equivalent resources?
- AA counting semaphore initialized to five
- BA file extension
- CA recursion counter local to each thread
- DAn unbounded queue alone
Show answer
Answer: A (A counting semaphore initialized to five)
Each acquisition consumes a permit and each release restores one. The count limits concurrent users when acquisition and release are correctly paired.
- 6.easy
Which workload is most clearly CPU-bound?
- AWaiting for a remote response
- BWaiting for keyboard input
- CPerforming a long numerical computation
- DSleeping until a timer fires
Show answer
Answer: C (Performing a long numerical computation)
A CPU-bound workload spends most of its time computing. More concurrency will not necessarily improve it if processing resources are already saturated.
- 7.mid
What is starvation in scheduling or synchronization?
- AEvery task runs at once
- BA process runs out of disk space
- CA program loses its source code
- DA task repeatedly fails to obtain the resources needed to progress
Show answer
Answer: D (A task repeatedly fails to obtain the resources needed to progress)
Starvation can happen even while other tasks continue making progress. Deadlock instead involves participants blocked by unresolved resource dependencies.
- 8.mid
What is the main idea of copy-on-write?
- AAlways copy all memory immediately
- BShare data until a write requires a private copy
- CPrevent every future write
- DStore memory only on disk
Show answer
Answer: B (Share data until a write requires a private copy)
Copy-on-write delays copying until modification is needed. It can reduce initial memory and copying costs when shared data remains unchanged.
- 9.easy
Why do operating systems separate user mode and kernel mode?
- ATo restrict privileged operations and protect system resources
- BTo prevent all application bugs
- CTo give every program direct hardware control
- DTo eliminate system calls
Show answer
Answer: A (To restrict privileged operations and protect system resources)
Privilege separation limits what ordinary application code can do directly. System calls provide controlled access to kernel services.
- 10.mid
What is thrashing in a virtual-memory system?
- AA healthy cache hit rate
- BA faster context switch
- CExcessive paging that leaves little time for useful work
- DA completed disk backup
Show answer
Answer: C (Excessive paging that leaves little time for useful work)
When active working sets exceed available memory, repeated page movement can dominate execution. Reducing memory pressure can help more than adding concurrent work.
- 11.mid
Two threads perform an unsynchronized read-modify-write increment on shared state. What can happen?
- AThe result is always correct
- BThe operating system always serializes the whole increment
- CEvery increment creates a process
- DOne update can overwrite another
Show answer
Answer: D (One update can overwrite another)
The compound operation can interleave so both threads read the same old value and write the same new value. A suitable atomic operation or lock is needed.
No questions match these filters. Try a different subtopic or clear the filters.