









































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 – Final Exam Review (150 Questions) Topics Covered
Answer: A Rationale: Multilevel feedback queue adapts to process behavior (CPU-bound vs I/O-bound). Q7. Which of the following is a race condition? A) Multiple processes reading the same file simultaneously B) Multiple threads accessing shared data concurrently, with outcome depending on execution order C) A deadlock situation D) A process waiting indefinitely for an event Answer: B Rationale: Race conditions occur when concurrent access to shared data leads to unpredictable results. Q8. What is the critical section problem? A) A section of code that must be executed by only one process at a time B) A memory region that cannot be accessed C) A file that is locked D) A CPU register Answer: A Rationale: Critical sections require mutual exclusion to prevent race conditions. Q9. Which of the following conditions must be satisfied by a solution to the critical section problem? A) Mutual exclusion, progress, bounded waiting B) Fast execution, low memory, no context switching C) Preemption, scheduling, priority inversion D) Deadlock, starvation, livelock
Answer: A Rationale: These three conditions are necessary for a correct solution. Q10. A mutex is used for: A) Mutual exclusion between processes/threads B) Memory allocation C) File I/O D) CPU scheduling Answer: A Rationale: Mutex (mutual exclusion) provides locking for critical sections. Q11. What is the difference between a binary semaphore and a mutex? A) Mutex has ownership; semaphore does not B) Semaphore is always faster C) Mutex can count to more than 1 D) No difference Answer: A Rationale: Mutexes can only be unlocked by the thread that locked them; semaphores have no ownership. Q12. A counting semaphore initialized to 3 means: A) At most 3 processes can enter the critical section B) Exactly 3 processes must wait C) 3 processes are deadlocked D) 3 processes are terminated Answer: A Rationale: Counting semaphores control access to a pool of resources.
Q16. The Banker's Algorithm is used for: A) Deadlock avoidance B) Deadlock detection C) Deadlock recovery D) Memory allocation Answer: A Rationale: The Banker's Algorithm simulates resource allocation to avoid unsafe states. Q17. In deadlock prevention, breaking the "hold and wait" condition can be achieved by: A) Requiring processes to request all resources at the beginning B) Allowing preemption of held resources C) Detecting cycles in the resource allocation graph D) Using a timeout Answer: A Rationale: Requesting all resources upfront prevents holding some while waiting for others. Q18. What is the difference between paging and segmentation? A) Paging divides memory into fixed-size blocks; segmentation into variable-sized logical units B) Segmentation uses fixed-size blocks C) Paging is only for virtual memory D) No difference Answer: A Rationale: Paging is transparent to the programmer; segmentation is visible.
Q19. What is a page fault? A) An attempt to access a page not currently in physical memory B) A programming error in the page table C) A disk error D) A CPU exception for division by zero Answer: A Rationale: Page faults trigger the OS to load the required page from disk. Q20. Which page replacement algorithm is theoretically optimal but not implementable? A) LRU (Least Recently Used) B) FIFO (First In First Out) C) Optimal (replace page used furthest in the future) D) Clock algorithm Answer: C Rationale: Optimal requires future knowledge; used as a benchmark. Q21. Belady's anomaly occurs in which page replacement algorithm? A) FIFO B) LRU C) Optimal D) Clock Answer: A Rationale: FIFO can show increased page faults with more frames. Q22. The LRU (Least Recently Used) page replacement algorithm replaces: A) The page that has been used most recently B) The page that has not been used for the longest time
Answer: A Rationale: EAT = (TLB hit time + TLB miss penalty) × page hit rate + page fault penalty. Q26. What is the purpose of the "dirty bit" in a page table entry? A) Indicates whether the page has been modified (written to) since loaded B) Indicates the page is corrupted C) Indicates the page is read-only D) Indicates the page is executable Answer: A Rationale: Dirty pages must be written back to disk when evicted. Q27. Which memory allocation strategy is prone to external fragmentation? A) Paging B) Segmentation C) Both paging and segmentation D) Neither Answer: B Rationale: Segmentation uses variable-sized partitions, leading to external fragmentation. Paging uses fixed-size frames. Q28. Internal fragmentation occurs when: A) Allocated memory is slightly larger than requested memory B) Memory is too small for a process C) Pages are swapped to disk D) The TLB misses Answer: A Rationale: Internal fragmentation is wasted space within an allocated block (e.g., last page of a process).
Q29. What is a "global page replacement" algorithm? A) Pages from all processes compete for all frames B) Each process has its own fixed frames C) Only the kernel can replace pages D) Pages are never replaced Answer: A Rationale: Global replacement allows a process to take frames from another. Q30. Which of the following is a file allocation method? A) Contiguous, Linked, Indexed B) FIFO, LRU, Optimal C) Mutex, Semaphore, Monitor D) FCFS, SJF, Round Robin Answer: A Rationale: File allocation methods determine how file blocks are placed on disk. Q31. Which file allocation method suffers from external fragmentation? A) Contiguous allocation B) Linked allocation C) Indexed allocation D) All of the above Answer: A Rationale: Contiguous allocation requires a single contiguous block, leading to fragmentation. Q32. In indexed file allocation, where are the block pointers stored? A) In an index block
Answer: A Rationale: Inodes contain all information about a file except its name. Q36. Which file system structure uses a bitmap for free space management? A) A binary array where each bit represents a free (0) or allocated (1) block B) A linked list of free blocks C) A counting semaphore D) A TLB entry Answer: A Rationale: Bitmaps are efficient for finding contiguous free blocks. Q37. What is the main advantage of a journaling file system (e.g., ext3/ext4, NTFS)? A) Faster recovery after a crash by logging operations before committing B) Higher storage capacity C) Simpler structure D) No need for backups Answer: A Rationale: Journaling reduces fsck time and prevents corruption. Q38. In a file system, what is a "directory"? A) A special file that maps names to inodes B) A physical disk partition C) A memory region D) A process queue Answer: A Rationale: Directories organize files hierarchically.
Q39. What is the maximum file size in a typical inode with direct, single indirect, double indirect, and triple indirect pointers? A) Depends on block size and number of pointers B) Always 4 GB C) Always 64 KB D) Unlimited Answer: A Rationale: The formula: block size × (block size / pointer size)ⁿ for each indirect level. Q40. Which of the following is a disk scheduling algorithm? A) SCAN (elevator) B) Round Robin C) Priority D) FIFO page replacement Answer: A Rationale: SCAN, C-SCAN, LOOK, FCFS, SSTF are disk scheduling algorithms. Q41. The elevator algorithm (SCAN) for disk scheduling: A) Moves the disk arm in one direction, servicing requests, then reverses B) Always serves the closest request first C) Services requests in order of arrival D) Never moves backwards Answer: A Rationale: SCAN reduces starvation but can cause long waits at edges. Q42. What is the purpose of DMA (Direct Memory Access)? A) Allows I/O devices to transfer data directly to/from memory without CPU intervention
Answer: A Rationale: Device drivers provide a uniform interface to hardware. Q46. Which of the following is a characteristic of a monolithic kernel? A) All OS services run in kernel space in a single address space B) OS services run in user space as separate servers C) Only the scheduler runs in kernel space D) It is slower than microkernel Answer: A Rationale: Monolithic kernels (Linux, Unix) have performance advantages but less modularity. Q47. A microkernel architecture differs from a monolithic kernel in that: A) Only essential services run in kernel space; other services run in user space B) All services run in user space C) No services run in kernel space D) It cannot support multiple OSes Answer: A Rationale: Microkernels (e.g., QNX, L4) are more modular but have more context switches. Q48. What is a system call? A) A request from a user program to the OS kernel for a service B) A hardware interrupt C) A scheduling decision D) A memory allocation Answer: A Rationale: System calls provide the interface between user programs and the OS.
Q49. Which of the following is NOT a typical system call category? A) Process control B) File management C) Device management D) Color management Answer: D Rationale: Common categories: process, file, device, information, communication. Q50. What is the difference between a process and a thread? A) Threads share the same address space; processes have separate address spaces B) Processes share address space; threads are separate C) No difference D) Threads cannot execute concurrently Answer: A Rationale: Threads within a process share code, data, and files. Q51. Which multithreading model maps many user-level threads to a single 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., old Green threads) has poor concurrency but low overhead.
C) A deadlock condition D) A page fault Answer: A Rationale: Buffer overflows can execute arbitrary code via control flow hijacking. Q56. Which countermeasure protects against buffer overflow by preventing code execution on the stack? A) NX bit (No-Execute, DEP) B) ASLR C) Paging D) Segmentation Answer: A Rationale: NX/DEP marks stack as non-executable. Q57. What is a "canary" in stack protection? A) A known value placed between buffer and return address to detect overflow B) A bird detection system C) A scheduling algorithm D) A file system feature Answer: A Rationale: Stack canaries (e.g., GCC's - fstack-protector) detect corruption. Q58. Which of the following is a malware type? A) Virus, worm, Trojan, ransomware B) Mutex, semaphore, monitor C) FIFO, LRU, OPT D) FCFS, SJF, RR
Answer: A Rationale: Malware includes viruses, worms, Trojans, ransomware, rootkits, spyware. Q59. A worm differs from a virus because: A) A worm self-replicates without attaching to a host program B) A virus does not replicate C) Worms require user interaction D) Viruses are always harmless Answer: A Rationale: Worms spread via networks autonomously. Q60. What is a rootkit? A) Malware that hides its presence by modifying OS components B) A type of worm C) A scheduling algorithm D) A file system Answer: A Rationale: Rootkits may hook system calls or load malicious kernel modules. Q61. What is the principle of least privilege? A) Users and processes should have only the minimum permissions necessary B) Users should have maximum permissions C) All processes run as root D) No permissions needed Answer: A Rationale: Least privilege limits damage from attacks or bugs.