





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































Operating System – Comprehensive Final Exam (200 Questions) Full Coverage Topics
Answer: A Rationale: Context switching is pure overhead; OS aims to minimize it. Q8. A process is created via which system call in Unix? A) fork() B) open() C) read() D) write() Answer: A Rationale: fork() creates a new process by duplicating the parent. Q9. What does exec() system call do? A) Replaces current process image with a new program B) Creates a new process C) Terminates a process D) Waits for child process Answer: A Rationale: exec() loads a new binary into the current process. Q10. A zombie process is one that: A) Has terminated but parent hasn't called wait() B) Is running but using no CPU C) Is waiting for I/O D) Is deadlocked Answer: A Rationale: Zombies consume only PCB entries.
Q11. An orphan process is: A) A process whose parent terminated (adopted by init/systemd) B) A process with no children C) A process in deadlock D) A process that is waiting Answer: A Rationale: Orphans are reparented to PID 1 (init/systemd). Q12. What is the difference between preemptive and non-preemptive scheduling? A) Preemptive can forcibly remove CPU from process; non-preemptive cannot until the process blocks or terminates B) Non-preemptive can remove CPU at any time C) No difference D) Preemptive is older Answer: A Rationale: Preemptive scheduling uses timer interrupts. Q13. Which scheduling algorithm is non-preemptive? A) FCFS (First Come First Served) B) Round Robin C) Preemptive SJF D) Priority with preemption Answer: A Rationale: FCFS runs to completion without interruption. Q14. In SJF scheduling, the process with the ________ runs next. A) Shortest next CPU burst B) Longest next CPU burst
Q18. If the time quantum is very small, Round Robin causes: A) Excessive context switching overhead B) No overhead C) Deadlock D) Starvation Answer: A Rationale: Too many context switches degrade throughput. Q19. The convoy effect occurs in: A) FCFS (short processes behind long process) B) SJF C) Round Robin D) Priority scheduling Answer: A Rationale: Convoy effect increases average waiting time. Q20. Multilevel feedback queue scheduling: A) Allows processes to move between queues based on behavior (aging, priority) B) Only uses one queue C) Never preempts D) Is the same as FCFS Answer: A Rationale: MFQ adapts to I/O-bound vs CPU-bound behavior. Q21. What is a thread? A) Lightweight unit of execution within a process, sharing address space B) A full process
C) A kernel module D) A file descriptor Answer: A Rationale: Threads share code, data, and files but have separate stacks and registers. Q22. Which thread model maps many user threads to one kernel thread? A) Many-to-one B) One-to-one C) Many-to-many D) Two-level Answer: A Rationale: Many-to-one (e.g., Green threads) cannot achieve parallelism on multiprocessors. Q23. What is the advantage of one-to-one threading (e.g., Linux, Windows)? A) True concurrency on multiprocessors B) Lower overhead C) No kernel involvement D) Simpler user-level scheduling Answer: A Rationale: Each user thread maps to a distinct kernel thread. Q24. Which of the following is thread-private (not shared with other threads in the same process)? A) Stack and register set B) Code segment C) Data segment D) Open files
Q28. A mutex (mutual exclusion) is: A) A lock with ownership (only the locker can unlock) B) A counting semaphore C) A condition variable D) A barrier Answer: A Rationale: Mutexes are simpler and often faster than semaphores. Q29. A binary semaphore initialized to 1 behaves like: A) A mutex (but without ownership) B) A counting semaphore C) A spinlock D) A barrier Answer: A Rationale: Binary semaphores can be used for mutual exclusion but lack ownership. Q30. A counting semaphore initialized to N is used for: A) Controlling access to a pool of N identical resources B) Mutual exclusion C) Condition waiting D) Thread creation Answer: A Rationale: Example: N = number of available database connections. Q31. What is a spinlock? A) A lock where a thread busy-waits (consumes CPU) instead of sleeping
B) A lock that always blocks C) A semaphore D) A mutex Answer: A Rationale: Spinlocks are efficient for very short critical sections on multiprocessors. Q32. What is priority inversion? A) Low-priority process holding lock needed by high-priority process B) High-priority preempting low-priority C) Equal priorities D) Deadlock Answer: A Rationale: Solved by priority inheritance protocol (boost lock-holder to high priority). Q33. What is a deadlock? A) Two or more processes circularly waiting for resources held by each other B) One process waiting for I/O C) A scheduling error D) A page fault Answer: A Rationale: Deadlock requires all four Coffman conditions simultaneously. Q34. Which is NOT a necessary condition for deadlock? A) Mutual exclusion B) Hold and wait C) No preemption D) Priority scheduling
Q38. Deadlock detection in a resource allocation graph involves: A) Looking for cycles B) Running Banker's C) Using semaphores D) Killing processes Answer: A Rationale: A cycle in a single-instance RAG means deadlock. Q39. Livelock differs from deadlock because: A) Processes continuously change state but make no progress B) Processes are blocked C) Processes terminate D) No difference Answer: A Rationale: Livelock example: two processes each yield to the other. Q40. Memory management unit (MMU) is responsible for: A) Translating virtual addresses to physical addresses B) CPU scheduling C) File I/O D) Interrupt handling Answer: A Rationale: The MMU performs address translation using page tables. Q41. What is external fragmentation? A) Free memory broken into small, non-contiguous blocks B) Wasted space within an allocated block
C) Insufficient total memory D) Page fault Answer: A Rationale: External fragmentation occurs in segmentation and dynamic partitioning. Q42. Internal fragmentation occurs in: A) Paging (wasted space in last page) B) Segmentation C) Both D) Neither Answer: A Rationale: Internal fragmentation is the unused space within a fixed-size block. Q43. In paging, the logical address is divided into: A) Page number and page offset B) Segment number and offset C) Frame number and offset D) Page number and frame number Answer: A Rationale: Page number indexes the page table; offset is within the page. Q44. A page fault occurs when: A) The accessed page is not in physical memory B) The page table is corrupted C) There is a protection violation D) The TLB is full
Q48. Belady's anomaly (more frames, more page faults) occurs in: A) FIFO B) LRU C) Optimal D) Clock Answer: A Rationale: FIFO can exhibit this counterintuitive behavior. Q49. LRU page replacement: A) Replaces page that has not been used for the longest time B) Replaces page that was used most recently C) Replaces a random page D) Replaces the first page in memory Answer: A Rationale: LRU approximates Optimal using past access patterns. Q50. The Clock (second chance) algorithm is a: A) Approximate LRU using circular list and reference bits B) FIFO variant C) Optimal algorithm D) Random algorithm Answer: A Rationale: Clock is efficient and used in many OSes. Q51. The working set of a process is: A) Set of pages currently in active use (recently referenced) B) The entire address space C) The code segment only D) The stack only
Answer: A Rationale: Working set model prevents thrashing. Q52. Thrashing occurs when: A) System spends more time swapping than executing B) CPU utilization is 100% C) Memory is idle D) Disk is idle Answer: A Rationale: Thrashing leads to low CPU utilization despite high disk activity. Q53. What is the reference bit used for? A) Indicates page has been accessed (read or written) B) Indicates page is dirty C) Indicates page is protected D) Indicates page is shared Answer: A Rationale: Reference bits are cleared periodically by the OS. Q54. The dirty (modified) bit indicates: A) Page has been written to; must be written back to disk before eviction B) Page is corrupted C) Page is read-only D) Page is executable Answer: A Rationale: Dirty pages require disk write; clean pages can be discarded.
C) Pages loaded proactively D) No paging Answer: A Rationale: Demand paging reduces initial load time and memory usage. Q59. Copy-on-write (COW) is used: A) After fork(), pages are shared until either process writes B) To encrypt memory C) To compress memory D) To allocate memory Answer: A Rationale: COW defers copying until necessary, improving fork() performance. Q60. What is the page size trade-off? A) Larger pages reduce page table size but increase internal fragmentation B) Larger pages always better C) Smaller pages always better D) No trade-off Answer: A Rationale: Modern systems use mixed page sizes (e.g., 4KB and 2MB huge pages). Q61. A file is: A) Named collection of persistent data stored on secondary storage B) A memory region C) A process D) A system call Answer: A Rationale: Files provide long-term storage across power cycles.
Q62. Which file allocation method is prone to external fragmentation? A) Contiguous allocation B) Linked allocation C) Indexed allocation D) Extents Answer: A Rationale: Contiguous allocation requires a single free block of sufficient size. Q63. In linked file allocation: A) Each block contains a pointer to the next block B) All blocks are contiguous C) An index block holds pointers D) No pointers needed Answer: A Rationale: Linked allocation has no external fragmentation but random access is slow. Q64. Indexed file allocation uses: A) A dedicated index block containing pointers to all data blocks B) A linked list C) Contiguous blocks D) A bitmap Answer: A Rationale: Indexed allocation supports efficient random access. Q65. UNIX inodes contain: A) File metadata (size, permissions, timestamps, block pointers)