Operating Systems questions
Processes, threads, scheduling, deadlocks, synchronisation and memory.
1. What is the main job of an operating system?
- Manage hardware resources and provide services to programs
- Design web pages
- Store only files
- Compile source code
Answer
A. Manage hardware resources and provide services to programs The OS sits between hardware and applications and manages CPU, memory, devices and files.
2. The core part of the OS that stays in memory and controls everything is the:
- Shell
- Compiler
- Kernel
- BIOS
Answer
C. Kernel The kernel handles processes, memory, devices and system calls.
3. A program in execution is called a:
- Process
- Library
- Thread pool
- File
Answer
A. Process A process is a running program with its own address space and state.
4. Which is NOT a standard process state?
- Running
- Ready
- Compiled
- Waiting
Answer
C. Compiled Typical states: new, ready, running, waiting (blocked), terminated.
5. Where does the OS keep information about a process such as its state, program counter and registers?
- Page table only
- File allocation table
- Boot sector
- Process Control Block (PCB)
Answer
D. Process Control Block (PCB) Each process has a PCB.
6. Saving the state of one process and loading another is called:
- Paging
- Thrashing
- Spooling
- Context switching
Answer
D. Context switching A context switch saves and restores CPU state.
7. Threads of the same process share:
- Their stacks
- Their registers
- Their program counters
- Code, data and open files
Answer
D. Code, data and open files Each thread has its own stack, registers and PC but shares the address space.
8. Which scheduling algorithm can cause starvation of long jobs?
- Round Robin
- None of these
- Shortest Job First (SJF)
- First Come First Served (FCFS)
Answer
C. Shortest Job First (SJF) Short jobs keep jumping ahead, so long jobs may wait forever.
9. Round Robin scheduling gives each process:
- A fixed time slice (quantum) in turn
- CPU time at random
- The CPU until it finishes
- Priority by size
Answer
A. A fixed time slice (quantum) in turn Processes take turns using a time quantum.
10. Three jobs arrive at time 0 with burst times 5, 3 and 8 (in that order). What is the average waiting time under FCFS?
- 5.33
- 3
- 4.33
- 6
Answer
C. 4.33 Waiting times are 0, 5 and 8; average = 13/3 ≈ 4.33.
11. Same jobs (bursts 5, 3, 8, all at time 0) under non-preemptive SJF. What is the average waiting time?
- 4.33
- 3
- 5
- 3.67
Answer
D. 3.67 Order 3, 5, 8: waiting 0, 3, 8; average = 11/3 ≈ 3.67.
12. Which is NOT one of the four necessary conditions for deadlock?
- Circular wait
- Preemption
- Mutual exclusion
- Hold and wait
Answer
B. Preemption The four conditions are mutual exclusion, hold and wait, no preemption and circular wait.
13. The Banker's algorithm is used for:
- Deadlock avoidance
- Page replacement
- CPU scheduling
- Disk scheduling
Answer
A. Deadlock avoidance It grants resources only if the system stays in a safe state.
14. A situation where a process waits indefinitely because others keep getting priority is:
- Fragmentation
- Thrashing
- Deadlock
- Starvation
Answer
D. Starvation Starvation is indefinite postponement; ageing fixes it.
15. A semaphore is used for:
- Translating addresses
- Allocating disk blocks
- Compiling programs
- Synchronising access to shared resources
Answer
D. Synchronising access to shared resources Semaphores use wait (P) and signal (V) operations.
16. A part of a program that accesses shared data and must not run in more than one process at a time is the:
- Critical section
- Kernel mode
- Stack segment
- Entry point
Answer
A. Critical section Only one process at a time may be in its critical section.
17. A binary semaphore is essentially the same as a:
- Counting semaphore
- Page table
- Monitor queue
- Mutex lock
Answer
D. Mutex lock It takes only the values 0 and 1.
18. Dividing physical memory into fixed-size blocks called frames and logical memory into pages is:
- Paging
- Segmentation
- Spooling
- Swapping
Answer
A. Paging Pages map onto frames through a page table.
19. Paging removes which kind of fragmentation?
- Neither
- Both kinds
- External fragmentation
- Internal fragmentation
Answer
C. External fragmentation Fixed-size frames remove external fragmentation, but the last page can waste space (internal).
20. A page fault occurs when:
- The CPU overheats
- The disk is full
- Two processes share a page
- The page a program needs is not in main memory
Answer
D. The page a program needs is not in main memory The OS must then load the page from disk.
21. When a system spends more time swapping pages than executing, it is called:
- Thrashing
- Buffering
- Caching
- Spooling
Answer
A. Thrashing Too little memory per process causes constant page faults.
22. Virtual memory allows:
- More CPU cores
- Faster disk writes only
- Files to be encrypted
- Programs larger than physical memory to run
Answer
D. Programs larger than physical memory to run Only needed pages are kept in RAM; the rest stay on disk.
23. The TLB (Translation Lookaside Buffer) is used to:
- Schedule processes
- Speed up virtual-to-physical address translation
- Store files
- Detect deadlock
Answer
B. Speed up virtual-to-physical address translation It caches recent page table entries.
24. Which page replacement algorithm can show Belady's anomaly?
- LRU
- Optimal
- FIFO
- LFU with ageing
Answer
C. FIFO With FIFO, adding frames can increase page faults.
25. Reference string 1, 2, 3, 1, 4, 2 with 3 frames under FIFO. How many page faults?
- 5
- 6
- 4
- 3
Answer
C. 4 1, 2, 3 are faults (3). 1 is a hit. 4 is a fault and replaces 1, the oldest: [4, 2, 3]. 2 is a hit. Total = 4.
26. A system call is:
- A request from a program for a service from the kernel
- A hardware fault
- A compiler error
- A phone call from the system
Answer
A. A request from a program for a service from the kernel Examples: read, write, fork, exec.
27. In Unix/Linux, which system call creates a new process?
- fork()
- exec()
- wait()
- exit()
Answer
A. fork() fork() duplicates the calling process; exec() replaces its program.
28. A child process whose parent has not yet collected its exit status is a:
- Zombie process
- Kernel thread
- Daemon
- Orphan process
Answer
A. Zombie process Its entry stays until the parent calls wait().
29. Which disk scheduling algorithm moves the head in one direction serving requests, then reverses (like a lift)?
- SCAN
- FCFS
- SSTF
- Random
Answer
A. SCAN SCAN is also called the elevator algorithm.
30. Spooling is mainly used for:
- Encryption
- CPU scheduling
- Queuing jobs for slow devices such as printers
- Memory allocation
Answer
C. Queuing jobs for slow devices such as printers Jobs are buffered on disk and sent to the device one by one.
31. Which of these is a real-time operating system use case?
- Watching videos offline
- Writing documents
- Controlling an aircraft's flight system
- Browsing websites
Answer
C. Controlling an aircraft's flight system Real-time systems must respond within strict deadlines.
32. The program that loads the operating system when a computer starts is the:
- Bootloader
- Linker
- Assembler
- Interpreter
Answer
A. Bootloader Firmware hands control to the bootloader, which loads the kernel.
33. In Operating Systems, which description best fits “process”?
- save and restore execution state between tasks
- tasks waiting cyclically for resources
- mutual-exclusion lock
- running program with its own address space
Answer
D. running program with its own address space process is used to running program with its own address space.
34. In Operating Systems, which description best fits “thread”?
- divide virtual memory into fixed-size pages
- select runnable tasks for CPU time
- execution path within a process
- synchronization primitive with a counter
Answer
C. execution path within a process thread is used to execution path within a process.
35. In Operating Systems, which description best fits “deadlock”?
- synchronization primitive with a counter
- mutual-exclusion lock
- running program with its own address space
- tasks waiting cyclically for resources
Answer
D. tasks waiting cyclically for resources deadlock is used to tasks waiting cyclically for resources.
36. In Operating Systems, which description best fits “semaphore”?
- save and restore execution state between tasks
- synchronization primitive with a counter
- map process addresses to physical storage
- running program with its own address space
Answer
B. synchronization primitive with a counter semaphore is used to synchronization primitive with a counter.
37. In Operating Systems, which description best fits “mutex”?
- execution path within a process
- save and restore execution state between tasks
- request an operating system kernel service
- mutual-exclusion lock
Answer
D. mutual-exclusion lock mutex is used to mutual-exclusion lock.
38. In Operating Systems, which description best fits “paging”?
- request an operating system kernel service
- map process addresses to physical storage
- save and restore execution state between tasks
- divide virtual memory into fixed-size pages
Answer
D. divide virtual memory into fixed-size pages paging is used to divide virtual memory into fixed-size pages.
39. In Operating Systems, which description best fits “virtual memory”?
- map process addresses to physical storage
- divide virtual memory into fixed-size pages
- request an operating system kernel service
- tasks waiting cyclically for resources
Answer
A. map process addresses to physical storage virtual memory is used to map process addresses to physical storage.
40. In Operating Systems, which description best fits “scheduling”?
- select runnable tasks for CPU time
- execution path within a process
- divide virtual memory into fixed-size pages
- synchronization primitive with a counter
Answer
A. select runnable tasks for CPU time scheduling is used to select runnable tasks for CPU time.
41. In Operating Systems, which description best fits “context switch”?
- running program with its own address space
- synchronization primitive with a counter
- divide virtual memory into fixed-size pages
- save and restore execution state between tasks
Answer
D. save and restore execution state between tasks context switch is used to save and restore execution state between tasks.
42. In Operating Systems, which description best fits “system call”?
- synchronization primitive with a counter
- request an operating system kernel service
- mutual-exclusion lock
- divide virtual memory into fixed-size pages
Answer
B. request an operating system kernel service system call is used to request an operating system kernel service.
43. Which Operating Systems concept matches this description: “running program with its own address space”?
- thread
- scheduling
- context switch
- process
Answer
D. process The definition describes process.
44. Which Operating Systems concept matches this description: “execution path within a process”?
- context switch
- semaphore
- thread
- virtual memory
Answer
C. thread The definition describes thread.
45. Which Operating Systems concept matches this description: “tasks waiting cyclically for resources”?
- paging
- mutex
- system call
- deadlock
Answer
D. deadlock The definition describes deadlock.
46. Which Operating Systems concept matches this description: “synchronization primitive with a counter”?
- mutex
- context switch
- virtual memory
- semaphore
Answer
D. semaphore The definition describes semaphore.
47. Which Operating Systems concept matches this description: “mutual-exclusion lock”?
- paging
- virtual memory
- mutex
- system call
Answer
C. mutex The definition describes mutex.
48. Which Operating Systems concept matches this description: “divide virtual memory into fixed-size pages”?
- virtual memory
- mutex
- paging
- semaphore
Answer
C. paging The definition describes paging.
49. Which Operating Systems concept matches this description: “map process addresses to physical storage”?
- virtual memory
- deadlock
- context switch
- process
Answer
A. virtual memory The definition describes virtual memory.
50. Which Operating Systems concept matches this description: “select runnable tasks for CPU time”?
- deadlock
- scheduling
- context switch
- semaphore
Answer
B. scheduling The definition describes scheduling.
51. Which Operating Systems concept matches this description: “save and restore execution state between tasks”?
- paging
- context switch
- process
- semaphore
Answer
B. context switch The definition describes context switch.
52. Which Operating Systems concept matches this description: “request an operating system kernel service”?
- system call
- thread
- context switch
- scheduling
Answer
A. system call The definition describes system call.
Mock test
- Operating Systems Mock Test 15 questions · 15 min