Operating System Interview Questions and Answers

Operating systems fundamentals that come up in technical rounds, with clear answers.

  1. Q1. What is the difference between a process and a thread?

    • A. Threads of a process share its memory; processes have separate memory
    • B. Processes are faster to create
    • C. There is no difference
    • D. Threads cannot run in parallel
    Show answer

    Answer: A. Threads of a process share its memory; processes have separate memory
    That's why threads are lighter but need synchronisation.

  2. Q2. Which scheduling algorithm can cause starvation of long jobs?

    • A. None of them
    • B. Round Robin
    • C. First Come First Served
    • D. Shortest Job First
    Show answer

    Answer: D. Shortest Job First
    Short jobs keep jumping ahead, so long ones may wait forever. Aging fixes it.

  3. Q3. Round Robin scheduling uses:

    • A. Random selection
    • B. Priorities only
    • C. A fixed time slice (quantum) for each process in turn
    • D. The shortest job first
    Show answer

    Answer: C. A fixed time slice (quantum) for each process in turn
    It's fair and good for time-sharing systems.

  4. Q4. A deadlock requires which four conditions?

    • A. Read, write, execute, delete
    • B. Mutual exclusion, hold and wait, no preemption, circular wait
    • C. Paging, segmentation, swapping, caching
    • D. Starvation, aging, priority, quantum
    Show answer

    Answer: B. Mutual exclusion, hold and wait, no preemption, circular wait
    Breaking any one condition prevents deadlock.

  5. Q5. Virtual memory allows:

    • A. Faster CPUs
    • B. More cores
    • C. Unlimited disk space
    • D. Programs to use more memory than physically available, using disk
    Show answer

    Answer: D. Programs to use more memory than physically available, using disk
    Pages not in use are swapped out to disk.

  6. Q6. A page fault occurs when:

    • A. A program accesses a page that isn't in RAM
    • B. Two processes share memory
    • C. The disk is full
    • D. The CPU overheats
    Show answer

    Answer: A. A program accesses a page that isn't in RAM
    The OS loads the page from disk and resumes the program.

  7. Q7. What is thrashing?

    • A. The system spends more time swapping pages than doing work
    • B. Fast context switching
    • C. A hardware failure
    • D. A virus
    Show answer

    Answer: A. The system spends more time swapping pages than doing work
    Too many processes for too little RAM.

  8. Q8. A semaphore is used for:

    • A. Network routing
    • B. Controlling access to shared resources between processes or threads
    • C. Compiling code
    • D. Storing files
    Show answer

    Answer: B. Controlling access to shared resources between processes or threads
    Wait (P) and signal (V) operations coordinate access.

  9. Q9. A mutex differs from a counting semaphore in that it:

    • A. Is only for files
    • B. Allows unlimited holders
    • C. Is a type of scheduler
    • D. Allows only one holder at a time and is owned by the locker
    Show answer

    Answer: D. Allows only one holder at a time and is owned by the locker
    A counting semaphore can allow N simultaneous holders.

  10. Q10. What is a context switch?

    • A. Changing the user's language
    • B. Restarting the computer
    • C. Switching between files
    • D. Saving one process's state and loading another's
    Show answer

    Answer: D. Saving one process's state and loading another's
    It has overhead, so too many switches slow the system.

  11. Q11. Which memory is fastest?

    • A. Hard disk
    • B. SSD
    • C. RAM
    • D. CPU registers
    Show answer

    Answer: D. CPU registers
    Registers → cache → RAM → SSD → HDD, from fastest to slowest.

  12. Q12. The kernel is:

    • A. The core of the OS that manages CPU, memory and devices
    • B. The BIOS
    • C. A user application
    • D. A type of file
    Show answer

    Answer: A. The core of the OS that manages CPU, memory and devices
    It runs in privileged mode.

  13. Q13. A zombie process is:

    • A. A finished process whose parent hasn't collected its exit status
    • B. A paused process
    • C. A virus
    • D. A process using 100% CPU
    Show answer

    Answer: A. A finished process whose parent hasn't collected its exit status
    It holds an entry in the process table until the parent calls wait().

  14. Q14. Which page replacement algorithm replaces the page not used for the longest time?

    • A. Random
    • B. FIFO
    • C. Optimal
    • D. LRU (Least Recently Used)
    Show answer

    Answer: D. LRU (Least Recently Used)
    Optimal replaces the page used farthest in the future, which can't be known in practice.

  15. Q15. A race condition occurs when:

    • A. A loop never ends
    • B. The result depends on the timing of threads accessing shared data
    • C. The CPU runs too fast
    • D. Two programs compete in speed tests
    Show answer

    Answer: B. The result depends on the timing of threads accessing shared data
    Protect shared data with locks.

  16. Q16. Paging divides memory into:

    • A. Threads
    • B. Files
    • C. Variable-size segments
    • D. Fixed-size blocks
    Show answer

    Answer: D. Fixed-size blocks
    Fixed-size pages avoid external fragmentation.

  17. Q17. What is a system call?

    • A. A phone call
    • B. A hardware interrupt only
    • C. A function inside the program
    • D. A request from a program to the OS kernel for a service
    Show answer

    Answer: D. A request from a program to the OS kernel for a service
    e.g. read(), write(), fork().

  18. Q18. fork() in Unix:

    • A. Opens a file
    • B. Creates a new child process
    • C. Ends a process
    • D. Creates a thread
    Show answer

    Answer: B. Creates a new child process
    The child is a copy of the parent; fork returns 0 in the child.

  19. Q19. Internal fragmentation happens when:

    • A. Allocated blocks are larger than needed, wasting space inside them
    • B. The disk is full
    • C. Files are deleted
    • D. Free memory is split into small pieces
    Show answer

    Answer: A. Allocated blocks are larger than needed, wasting space inside them
    External fragmentation is free memory scattered into unusable gaps.

  20. Q20. Which of these is NOT an operating system?

    • A. Python
    • B. Android
    • C. Windows
    • D. Linux
    Show answer

    Answer: A. Python
    Python is a programming language; the others are operating systems.

Practised these? Now prove it.

Take a timed mock test with new questions every attempt, earn a verified certificate at 70%+, and get noticed by employers.

Start a mock test