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.

  21. Q21. What is an operating system?

    • A. A programming language
    • B. A type of computer
    • C. Software that manages hardware and provides services to programs
    • D. A web browser
    Show answer

    Answer: C. Software that manages hardware and provides services to programs
    Windows, Linux, macOS and Android are operating systems.

  22. Q22. What is the kernel?

    • A. The core of the OS that manages CPU, memory and devices
    • B. The user interface
    • C. A text editor
    • D. The BIOS
    Show answer

    Answer: A. The core of the OS that manages CPU, memory and devices
    Programs ask the kernel for services through system calls.

  23. Q23. What is a system call?

    • A. A function inside main()
    • B. A hardware interrupt only
    • C. A phone call to support
    • D. A request from a program to the kernel, e.g. to open a file
    Show answer

    Answer: D. A request from a program to the kernel, e.g. to open a file
    Examples: open, read, write, fork.

  24. Q24. What is the difference between a process and a thread?

    • A. A thread is bigger than a process
    • B. Processes share memory; threads don't
    • C. Threads of a process share memory; processes have separate memory
    • D. They are the same
    Show answer

    Answer: C. Threads of a process share memory; processes have separate memory
    Threads are lighter to create and switch between.

  25. Q25. What is a context switch?

    • A. Saving one process's state and loading another's on the CPU
    • B. Restarting the computer
    • C. Switching between two monitors
    • D. Changing the OS
    Show answer

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

  26. Q26. Which scheduling algorithm runs the job that arrived first?

    • A. SJF
    • B. Round Robin
    • C. FCFS (First Come First Served)
    • D. Priority
    Show answer

    Answer: C. FCFS (First Come First Served)
    Simple, but short jobs may wait behind long ones (convoy effect).

  27. Q27. Which scheduling algorithm gives the minimum average waiting time?

    • A. FCFS
    • B. Random
    • C. Round Robin
    • D. Shortest Job First (SJF)
    Show answer

    Answer: D. Shortest Job First (SJF)
    But it needs to know burst times and can starve long jobs.

  28. Q28. What does Round Robin scheduling use?

    • A. The shortest job first
    • B. A fixed time quantum for each process in turn
    • C. Priorities only
    • D. No preemption
    Show answer

    Answer: B. A fixed time quantum for each process in turn
    Fair and good for time-sharing systems.

  29. Q29. What is starvation?

    • A. A process waiting indefinitely because others always get the CPU first
    • B. A crash due to low power
    • C. A process using too much memory
    • D. A deadlock between two processes
    Show answer

    Answer: A. A process waiting indefinitely because others always get the CPU first
    Ageing (raising priority over time) prevents it.

  30. Q30. Which four conditions must all hold for a deadlock?

    • A. Starvation, ageing, paging, swapping
    • B. Read, write, execute, delete
    • C. Mutual exclusion, hold and wait, no preemption, circular wait
    • D. Fork, exec, wait, exit
    Show answer

    Answer: C. Mutual exclusion, hold and wait, no preemption, circular wait
    The Coffman conditions; break any one to prevent deadlock.

  31. Q31. What does the Banker's algorithm do?

    • A. Allocates virtual memory pages
    • B. Manages bank accounts
    • C. Avoids deadlock by granting resources only if the system stays in a safe state
    • D. Schedules processes by priority
    Show answer

    Answer: C. Avoids deadlock by granting resources only if the system stays in a safe state
    Proposed by Dijkstra.

  32. Q32. What is a semaphore?

    • A. A memory page
    • B. A file system
    • C. A type of process
    • D. A counter used to control access to shared resources
    Show answer

    Answer: D. A counter used to control access to shared resources
    wait (P) decrements, signal (V) increments.

  33. Q33. What is a mutex?

    • A. A type of memory
    • B. A lock that lets only one thread into a critical section
    • C. A file permission
    • D. A scheduling algorithm
    Show answer

    Answer: B. A lock that lets only one thread into a critical section
    A binary semaphore with ownership.

  34. Q34. What is a race condition?

    • A. Two programs competing for disk space
    • B. A CPU overheating
    • C. A fast-running loop
    • D. When the result depends on the timing of concurrent threads
    Show answer

    Answer: D. When the result depends on the timing of concurrent threads
    Protect shared data with locks.

  35. Q35. What is a critical section?

    • A. Code that accesses shared data and must not run in two threads at once
    • B. The boot sector
    • C. The most important function
    • D. A section of RAM reserved for the OS
    Show answer

    Answer: A. Code that accesses shared data and must not run in two threads at once
    Solutions must give mutual exclusion, progress and bounded waiting.

  36. Q36. What is virtual memory?

    • A. Memory inside the CPU
    • B. Using disk space to extend RAM so programs can use more memory than physically exists
    • C. Cloud storage
    • D. Memory on a graphics card
    Show answer

    Answer: B. Using disk space to extend RAM so programs can use more memory than physically exists
    Pages move between RAM and disk as needed.

  37. Q37. What is paging?

    • A. Scrolling a document
    • B. Dividing memory into fixed-size pages and frames
    • C. Printing pages
    • D. Dividing memory into variable-size segments
    Show answer

    Answer: B. Dividing memory into fixed-size pages and frames
    Avoids external fragmentation.

  38. Q38. What is a page fault?

    • A. A full hard disk
    • B. Accessing a page that isn't currently in RAM
    • C. A syntax error
    • D. A broken memory chip
    Show answer

    Answer: B. Accessing a page that isn't currently in RAM
    The OS loads the page from disk.

  39. Q39. What is thrashing?

    • A. A process stuck in a loop
    • B. The system spends more time swapping pages than running programs
    • C. A disk being formatted
    • D. Overclocking the CPU
    Show answer

    Answer: B. The system spends more time swapping pages than running programs
    Caused by too little RAM for the running workload.

  40. Q40. Which page replacement algorithm replaces the page used longest ago?

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

    Answer: A. LRU (Least Recently Used)
    Optimal replaces the page not needed for the longest time in future, but it's not practical.

  41. Q41. What is Belady's anomaly?

    • A. A virus in memory
    • B. A deadlock in paging
    • C. Less RAM making programs faster
    • D. More frames causing more page faults with FIFO
    Show answer

    Answer: D. More frames causing more page faults with FIFO
    LRU and Optimal don't suffer from it.

  42. Q42. What is internal fragmentation?

    • A. Wasted space inside an allocated block
    • B. A corrupted file
    • C. A broken partition
    • D. Free space scattered between blocks
    Show answer

    Answer: A. Wasted space inside an allocated block
    e.g. a 4 KB page holding 1 KB of data.

  43. Q43. What is external fragmentation?

    • A. Unused space inside a page
    • B. Too many open files
    • C. Free memory split into small non-contiguous pieces
    • D. A disk with bad sectors
    Show answer

    Answer: C. Free memory split into small non-contiguous pieces
    Compaction or paging solves it.

  44. Q44. What is a TLB?

    • A. A process scheduler
    • B. A type of hard disk
    • C. A network protocol
    • D. A cache of recent page-table entries for fast address translation
    Show answer

    Answer: D. A cache of recent page-table entries for fast address translation
    Translation Lookaside Buffer.

  45. Q45. What does fork() do in Unix?

    • A. Splits a file
    • B. Creates a new child process that is a copy of the parent
    • C. Starts a thread
    • D. Deletes a process
    Show answer

    Answer: B. Creates a new child process that is a copy of the parent
    It returns 0 in the child and the child's PID in the parent.

  46. Q46. What is a zombie process?

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

    Answer: A. A finished process whose parent hasn't collected its exit status
    The parent must call wait().

  47. Q47. What is an orphan process?

    • A. A process with no threads
    • B. A process with no memory
    • C. A process that never started
    • D. A running process whose parent has exited
    Show answer

    Answer: D. A running process whose parent has exited
    init/systemd adopts it.

  48. Q48. What is the difference between preemptive and non-preemptive scheduling?

    • A. Preemptive can interrupt a running process; non-preemptive waits for it to finish or block
    • B. They are the same
    • C. Non-preemptive uses time slices
    • D. Preemptive never interrupts
    Show answer

    Answer: A. Preemptive can interrupt a running process; non-preemptive waits for it to finish or block
    Round Robin is preemptive; FCFS is non-preemptive.

  49. Q49. What is an interrupt?

    • A. A crashed program
    • B. A signal that makes the CPU pause and handle an event
    • C. A slow network
    • D. A deleted file
    Show answer

    Answer: B. A signal that makes the CPU pause and handle an event
    e.g. a key press or a timer.

  50. Q50. What is DMA (Direct Memory Access)?

    • A. A type of RAM
    • B. A CPU instruction
    • C. Memory protection
    • D. Devices transferring data to memory without using the CPU for each byte
    Show answer

    Answer: D. Devices transferring data to memory without using the CPU for each byte
    Frees the CPU during large transfers.

  51. Q51. What is spooling?

    • A. Sharing memory
    • B. Buffering jobs (like print jobs) on disk so a slow device can process them in turn
    • C. Compressing files
    • D. Formatting a disk
    Show answer

    Answer: B. Buffering jobs (like print jobs) on disk so a slow device can process them in turn
    Simultaneous Peripheral Operations On-Line.

  52. Q52. What is a file descriptor in Unix?

    • A. A file's name
    • B. The size of a file
    • C. A folder
    • D. A small integer that identifies an open file
    Show answer

    Answer: D. A small integer that identifies an open file
    0, 1 and 2 are stdin, stdout and stderr.

  53. Q53. What is the role of a bootloader?

    • A. Managing user accounts
    • B. Shutting down the computer
    • C. Running antivirus scans
    • D. Loading the operating system kernel into memory at start-up
    Show answer

    Answer: D. Loading the operating system kernel into memory at start-up
    GRUB is a common Linux bootloader.

  54. Q54. What is a real-time operating system?

    • A. Any modern OS
    • B. An OS with a clock on screen
    • C. An OS that guarantees responses within strict time limits
    • D. An OS that updates in real time
    Show answer

    Answer: C. An OS that guarantees responses within strict time limits
    Used in medical devices, cars and aircraft.

  55. Q55. What is the producer-consumer problem about?

    • A. Allocating memory to producers
    • B. Synchronising threads that add to and remove from a shared buffer
    • C. Scheduling the fastest process
    • D. Sorting a buffer
    Show answer

    Answer: B. Synchronising threads that add to and remove from a shared buffer
    Solved with semaphores for empty and full slots plus a mutex.

  56. Q56. What is the dining philosophers problem used to illustrate?

    • A. Network routing
    • B. Deadlock and resource sharing among processes
    • C. Memory paging
    • D. Disk scheduling
    Show answer

    Answer: B. Deadlock and resource sharing among processes
    Five philosophers, five forks, each needs two.

  57. Q57. Which disk scheduling algorithm moves the head back and forth like an elevator?

    • A. SCAN
    • B. FCFS
    • C. SSTF
    • D. LIFO
    Show answer

    Answer: A. SCAN
    C-SCAN returns to the start without serving requests on the way back.

  58. Q58. What is a monolithic kernel?

    • A. A kernel without drivers
    • B. A kernel written in one file
    • C. A kernel with only one process
    • D. A kernel where most OS services run in kernel space
    Show answer

    Answer: D. A kernel where most OS services run in kernel space
    Linux is monolithic; microkernels move services to user space.

  59. Q59. What is the purpose of the swap space?

    • A. A backup partition
    • B. Space for user files
    • C. Space for system logs
    • D. Disk space used when RAM is full
    Show answer

    Answer: D. Disk space used when RAM is full
    Swapping lets the OS run more programs than fit in RAM.

  60. Q60. What is a daemon in Unix?

    • A. A broken process
    • B. A virus
    • C. The root user
    • D. A background process that runs without a user interface
    Show answer

    Answer: D. A background process that runs without a user interface
    e.g. sshd, cron.

  61. Q61. What is multiprogramming?

    • A. Keeping several programs in memory so the CPU always has work
    • B. Using many CPUs
    • C. Writing programs in many languages
    • D. Running one program many times
    Show answer

    Answer: A. Keeping several programs in memory so the CPU always has work
    When one waits for I/O, another runs.

  62. Q62. What is the difference between user mode and kernel mode?

    • A. User mode is faster for everything
    • B. Kernel mode is for games
    • C. Kernel mode can execute privileged instructions; user mode can't
    • D. There is no difference
    Show answer

    Answer: C. Kernel mode can execute privileged instructions; user mode can't
    System calls switch from user to kernel mode.

  63. Q63. What is a shell?

    • A. The kernel
    • B. A program that reads and runs user commands
    • C. A file system
    • D. A hardware component
    Show answer

    Answer: B. A program that reads and runs user commands
    bash and zsh are shells.

  64. Q64. What does the chmod 755 command set on a Linux file?

    • A. Owner rw-, others r--
    • B. Everyone rwx
    • C. Owner rwx, group r-x, others r-x
    • D. Owner r--, others none
    Show answer

    Answer: C. Owner rwx, group r-x, others r-x
    7 = rwx, 5 = r-x.

  65. Q65. What is inter-process communication (IPC)?

    • A. Ways processes exchange data, like pipes, sockets and shared memory
    • B. Communication between CPUs
    • C. A network protocol only
    • D. Email between users
    Show answer

    Answer: A. Ways processes exchange data, like pipes, sockets and shared memory
    Message queues and signals are IPC too.

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