Operating System MCQ (Multiple Choice Questions and Answers)

91. What is the Shortest Remaining Time First (SRTF) scheduling algorithm?

  1. A non-preemptive algorithm that always runs the shortest available job to completion
  2. The preemptive version of SJF where if a new process arrives with a shorter remaining burst time than the current running process, the current process is preempted and the new process gets the CPU
  3. An algorithm that schedules jobs based on the shortest time remaining until their deadline
  4. A disk scheduling algorithm that services requests with the shortest remaining seek distance

Answer : B
Explanation: SRTF (Shortest Remaining Time First) is the preemptive version of Shortest Job First (SJF). At any point, if a new process arrives with a CPU burst shorter than the remaining time of the current process, the current process is preempted. SRTF is optimal — it achieves the minimum average waiting time among all preemptive scheduling algorithms. However, like SJF, it requires knowing future CPU burst times (difficult in practice). Problems: frequent context switching overhead, potential starvation of long processes, and requires knowing burst times upfront. SRTF is important for GATE examination numerical problems where average turnaround time and waiting time must be calculated.

92. What is the Optimal (OPT) page replacement algorithm?

  1. The page replacement algorithm that performs best on average for all workloads
  2. A theoretical page replacement algorithm that replaces the page that will not be used for the longest time in the future — achieves the minimum possible page fault rate but cannot be implemented in practice
  3. An algorithm that optimally balances page faults between different running processes
  4. The page replacement algorithm currently used by all modern operating systems

Answer : B
Explanation: The Optimal (OPT) page replacement algorithm — also called MIN or Bélády’s optimal algorithm — replaces the page that will not be needed for the longest time in the future. It achieves the absolute minimum number of page faults for any given reference string and number of frames. Problem: it requires knowledge of future page references, which is impossible to know at runtime. OPT is used as a benchmark — real algorithms like LRU are evaluated by how close they come to OPT. In practice, OPT is used only for simulation studies to measure the theoretical minimum. LRU approximates OPT using past reference history (locality of reference principle).

93. What is the difference between a batch operating system and a time-sharing operating system?

  1. Batch OS is faster; time-sharing OS supports more users simultaneously
  2. Batch OS processes jobs in groups without user interaction — optimizing throughput; Time-sharing OS provides interactive access to multiple users simultaneously — optimizing response time
  3. Time-sharing OS is older than batch OS in computing history
  4. Batch OS runs on mainframes only; time-sharing OS runs on personal computers only

Answer : B
Explanation: Batch OS: jobs (programs + data) are collected, grouped into batches, and submitted for processing without user interaction. The system runs one job after another automatically. Goal: maximize throughput (jobs completed per hour). No response time guarantee. Early examples: IBM 7090 with FMS, IBM OS/360. Time-Sharing OS: multiple users interact with the system simultaneously through terminals. The CPU switches rapidly between users, giving each the illusion of dedicated access. Goal: minimize response time. Each user gets immediate feedback to their commands. Examples: CTSS, Multics, UNIX. Modern OS: hybrid — background batch jobs can run while users interact interactively.

94. What is a distributed operating system?

  1. An operating system distributed across multiple CD-ROM discs for installation
  2. An OS that manages a collection of networked computers as a single unified system, transparently distributing computations and data across multiple machines to provide a single-system image to users
  3. An operating system where different components are managed by different vendors
  4. An OS that is installed separately on each machine in a network independently

Answer : B
Explanation: A Distributed OS manages multiple independent computers connected by a network as if they were one powerful computer. Key characteristics: Transparency (users don’t see individual machines — location, replication, and failure are hidden), Resource Sharing (CPU, memory, files, and printers are shared across nodes), Fault Tolerance (system continues working despite individual node failures), Scalability (adding more nodes increases capacity), and Openness (standard protocols enable interoperability). Examples: Amoeba, Plan 9, Google’s Borg/Kubernetes (container orchestration as a distributed OS). Network OS differs — it provides network services (file sharing) but each machine still runs its own OS independently.

95. What is the concept of a deadlock-free system in the context of the Banker’s Algorithm?

  1. A system where no processes are allowed to request more than one resource at a time
  2. A system in a safe state where there exists at least one sequence (safe sequence) in which all processes can be allocated their maximum resources and complete without causing deadlock
  3. A system where all resources are available in unlimited quantities to all processes
  4. A system where the OS kills any process that requests resources it might not get

Answer : B
Explanation: The Banker’s Algorithm (Dijkstra) ensures deadlock avoidance by maintaining the system in a “safe state.” A Safe State has a safe sequence — an ordering of all processes such that each process can obtain its maximum resource needs using currently available resources plus resources held by all preceding processes in the sequence. When a process requests resources: pretend to allocate them, check if the resulting state is safe (run safety algorithm), if safe — grant the request; if unsafe — deny and make the process wait. The safety algorithm tries to find a safe sequence: if found, safe state; if not found, unsafe state (but NOT necessarily deadlock — just risky). All deadlock states are unsafe, but not all unsafe states lead to deadlock.

Computer Graphics MCQ Questions And Answers

96. What is the concept of locality of reference in operating systems?

  1. A principle that references to data stored locally are faster than remote references
  2. The tendency of programs to access the same memory locations (temporal locality) or nearby memory locations (spatial locality) repeatedly over a short period of time
  3. A memory allocation strategy that places related data structures at adjacent addresses
  4. A scheduling policy that prefers processes running on the local CPU over remote CPUs

Answer : B
Explanation: Locality of Reference is the foundation of virtual memory and caching efficiency. Two types: Temporal Locality — recently accessed memory locations are likely to be accessed again soon (e.g., loop variables accessed repeatedly). Spatial Locality — memory locations near recently accessed locations are likely to be accessed soon (e.g., sequential array traversal). Locality of reference justifies: Cache memory effectiveness (recently used data/instructions cached near CPU), TLB effectiveness (recently used page translations cached), Working Set model (set of recently used pages likely to be needed again), Page replacement algorithms (LRU assumes recently unused pages unlikely to be needed). Programs that exhibit strong locality run efficiently in virtual memory systems with fewer page faults.

97. What is the difference between user mode and kernel mode in an operating system?

  1. User mode is for administrators; kernel mode is for regular users
  2. User mode is a restricted execution mode where programs cannot directly access hardware or OS resources; kernel mode is a privileged mode where the OS kernel runs with full hardware access — mode switching occurs via system calls and interrupts
  3. Kernel mode runs slower than user mode due to additional security checks
  4. User mode and kernel mode are both equally privileged in modern operating systems

Answer : B
Explanation: The Dual Mode Operation is fundamental to OS protection. User Mode: restricted execution environment for user applications. Cannot execute privileged instructions (halt CPU, modify page tables, access I/O ports directly). Violations cause traps/exceptions. Kernel Mode (Supervisor/Privileged Mode): the OS kernel runs here. Can execute all CPU instructions, access all memory, control all hardware. A CPU status bit (mode bit) indicates current mode. Mode switching: User → Kernel via system call, interrupt, or exception. Kernel → User via return from system call (IRET instruction). Mode switching has overhead (saving/restoring state) but is essential for security and stability — preventing user programs from corrupting the OS or other processes.

98. What is the aging technique in CPU scheduling?

  1. A technique that removes old, unused processes from memory after a timeout period
  2. A technique that gradually increases the priority of processes that have been waiting in the ready queue for a long time, preventing starvation in priority scheduling
  3. A method of measuring how long each process has been running to bill users
  4. A process scheduling approach that ages (slows) CPU-intensive processes to give I/O processes more CPU time

Answer : B
Explanation: Aging is a solution to the starvation problem in priority scheduling. In pure priority scheduling, low-priority processes may wait indefinitely as high-priority processes continuously arrive. Aging works by: increasing the priority of a waiting process by a fixed amount for every unit of time it has been waiting. Eventually, even the lowest-priority process will reach the highest priority and get CPU time. Example: if a process’s priority increases by 1 every 15 minutes, a process with initial priority 0 will have priority 10 after 2.5 hours, matching high-priority processes. Aging ensures bounded waiting — a fundamental requirement for any fair scheduling algorithm.

99. What is the difference between a monolithic and a layered operating system structure?

  1. Monolithic OS has one layer; layered OS has exactly two layers
  2. Monolithic OS has all components in a single large kernel with no structure; layered OS organizes the system into a hierarchy of layers where each layer uses services only from the layer below — improving modularity and debugging
  3. Layered OS runs faster than monolithic OS for all types of operations
  4. Monolithic OS is only used in mobile devices; layered OS is only used in servers

Answer : B
Explanation: Monolithic Structure: the entire OS is a single large executable in kernel space — all services (scheduling, file system, device drivers, memory management) are bundled together. Advantages: fast (direct function calls between components). Disadvantages: difficult to maintain, debug, and extend; a bug can crash the entire system. Examples: early Unix, MS-DOS. Layered Structure: OS divided into hierarchical layers, each built on the layer below. Classic example: THE system (Dijkstra, 1968) with 6 layers. Advantages: each layer is only tested against the layer below, simplifying debugging. Disadvantages: performance overhead (must pass through multiple layers for each operation), and difficulty in partitioning functionality cleanly between layers.

100. What is the purpose of the init process (PID 1) in Unix/Linux operating systems?

  1. The first process that initializes hardware during the boot sequence before the OS loads
  2. The first user-space process started by the kernel after booting — it is the ancestor of all other processes, responsible for starting system services, managing the system state, and adopting orphan processes
  3. A special process that initializes the memory management unit during system startup
  4. An initialization script that configures network settings when the system boots

Answer : B
Explanation: The init process (PID 1) is special in Unix/Linux systems. It is the first user-space process started by the kernel after the boot process completes. Responsibilities: starting and managing system services and daemons, managing system runlevels (traditional init) or targets (systemd), adopting orphan processes whose parents have terminated (calls wait() to prevent zombies), and being the last process to terminate during shutdown. Traditional init: reads /etc/inittab to start services based on runlevel. Modern systemd (most Linux distributions): faster parallel service startup, socket activation, dependency management between services, journaling (systemd-journald), and more. systemd is both PID 1 and a complete system and service manager.