pencils ready ✎

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.

11 questions
  1. 1.

    What is a race condition?

    easy
    1. AA result depends on timing of concurrent operations
    2. BA process always uses one CPU
    3. CA file cannot be opened
    4. 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. 2.

    Which memory is normally private to each thread?

    easy
    1. AAll global variables
    2. BIts execution stack
    3. CEvery heap object
    4. 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. 3.

    What does a context switch do?

    easy
    1. ACompiles source code
    2. BSaves and restores execution state
    3. CDeletes unused files
    4. 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. 4.

    What is a mutex primarily used for?

    easy
    1. AIncreasing disk capacity
    2. BProtecting a critical section from simultaneous access
    3. CMaking all operations lock-free
    4. 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. 5.

    Which primitive naturally limits concurrent access to a pool of five equivalent resources?

    mid
    1. AA counting semaphore initialized to five
    2. BA file extension
    3. CA recursion counter local to each thread
    4. 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. 6.

    Which workload is most clearly CPU-bound?

    easy
    1. AWaiting for a remote response
    2. BWaiting for keyboard input
    3. CPerforming a long numerical computation
    4. 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. 7.

    What is starvation in scheduling or synchronization?

    mid
    1. AEvery task runs at once
    2. BA process runs out of disk space
    3. CA program loses its source code
    4. 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. 8.

    What is the main idea of copy-on-write?

    mid
    1. AAlways copy all memory immediately
    2. BShare data until a write requires a private copy
    3. CPrevent every future write
    4. 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. 9.

    Why do operating systems separate user mode and kernel mode?

    easy
    1. ATo restrict privileged operations and protect system resources
    2. BTo prevent all application bugs
    3. CTo give every program direct hardware control
    4. 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. 10.

    What is thrashing in a virtual-memory system?

    mid
    1. AA healthy cache hit rate
    2. BA faster context switch
    3. CExcessive paging that leaves little time for useful work
    4. 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. 11.

    Two threads perform an unsynchronized read-modify-write increment on shared state. What can happen?

    mid
    1. AThe result is always correct
    2. BThe operating system always serializes the whole increment
    3. CEvery increment creates a process
    4. 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.

esc