Operating System Interview Questions and Answers
Operating systems fundamentals that come up in technical rounds, with clear answers.
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 answerHide answer
Answer: A. Threads of a process share its memory; processes have separate memory
That's why threads are lighter but need synchronisation.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 answerHide answer
Answer: D. Shortest Job First
Short jobs keep jumping ahead, so long ones may wait forever. Aging fixes it.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 answerHide answer
Answer: C. A fixed time slice (quantum) for each process in turn
It's fair and good for time-sharing systems.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 answerHide answer
Answer: B. Mutual exclusion, hold and wait, no preemption, circular wait
Breaking any one condition prevents deadlock.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 answerHide answer
Answer: D. Programs to use more memory than physically available, using disk
Pages not in use are swapped out to disk.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 answerHide answer
Answer: A. A program accesses a page that isn't in RAM
The OS loads the page from disk and resumes the program.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 answerHide answer
Answer: A. The system spends more time swapping pages than doing work
Too many processes for too little RAM.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 answerHide answer
Answer: B. Controlling access to shared resources between processes or threads
Wait (P) and signal (V) operations coordinate access.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 answerHide answer
Answer: D. Allows only one holder at a time and is owned by the locker
A counting semaphore can allow N simultaneous holders.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 answerHide answer
Answer: D. Saving one process's state and loading another's
It has overhead, so too many switches slow the system.Q11. Which memory is fastest?
- A. Hard disk
- B. SSD
- C. RAM
- D. CPU registers
Show answerHide answer
Answer: D. CPU registers
Registers → cache → RAM → SSD → HDD, from fastest to slowest.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 answerHide answer
Answer: A. The core of the OS that manages CPU, memory and devices
It runs in privileged mode.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 answerHide 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().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 answerHide answer
Answer: D. LRU (Least Recently Used)
Optimal replaces the page used farthest in the future, which can't be known in practice.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 answerHide answer
Answer: B. The result depends on the timing of threads accessing shared data
Protect shared data with locks.Q16. Paging divides memory into:
- A. Threads
- B. Files
- C. Variable-size segments
- D. Fixed-size blocks
Show answerHide answer
Answer: D. Fixed-size blocks
Fixed-size pages avoid external fragmentation.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 answerHide answer
Answer: D. A request from a program to the OS kernel for a service
e.g. read(), write(), fork().Q18. fork() in Unix:
- A. Opens a file
- B. Creates a new child process
- C. Ends a process
- D. Creates a thread
Show answerHide answer
Answer: B. Creates a new child process
The child is a copy of the parent; fork returns 0 in the child.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 answerHide answer
Answer: A. Allocated blocks are larger than needed, wasting space inside them
External fragmentation is free memory scattered into unusable gaps.Q20. Which of these is NOT an operating system?
- A. Python
- B. Android
- C. Windows
- D. Linux
Show answerHide 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