Operating System MCQ (Multiple Choice Questions and Answers)

51. What is the difference between monolithic and microkernel architectures?

  1. Monolithic kernels are smaller; microkernels are larger and more complex
  2. Monolithic kernels run all OS services in kernel space (fast but less modular); microkernels run only essential services in kernel space and move the rest to user space (more secure and modular but slower due to message passing overhead)
  3. Microkernels are used only in embedded systems; monolithic kernels are used only in servers
  4. Both architectures are identical — the terms describe the same kernel design

Answer : B
Explanation: Monolithic Kernel: all OS services (process management, memory management, file system, device drivers) run in kernel space with full hardware access. Advantages: fast performance (no message passing overhead). Disadvantages: a bug in any component can crash the entire system. Examples: Linux, Unix. Microkernel: only essential services (IPC, basic scheduling, memory management) run in kernel space; file systems, device drivers, and other services run as user-space processes. Advantages: more secure, modular, and fault-tolerant. Disadvantages: slower (services communicate via message passing). Examples: Minix, QNX, GNU Hurd. Hybrid kernels (Windows NT, macOS) combine aspects of both.

52. What is an interrupt in an operating system?

  1. A command that pauses a program while the user reads output on the screen
  2. A signal sent to the CPU by hardware or software that temporarily suspends the current execution, saves its state, and transfers control to an interrupt handler (ISR) to service the event
  3. A mechanism that blocks low-priority processes from accessing the CPU
  4. An error message displayed when a program crashes due to a memory fault

Answer : B
Explanation: Interrupts enable efficient I/O and event handling. Types: Hardware Interrupts — generated by I/O devices (keyboard press, mouse click, disk read completion, timer tick). Software Interrupts (Traps/Exceptions) — generated by programs (system calls, division by zero, page faults, invalid memory access). Process: CPU finishes current instruction, detects interrupt signal, saves current state (PC, registers) on the stack, jumps to Interrupt Service Routine (ISR) via Interrupt Vector Table, ISR handles the event, restores saved state, resumes interrupted program. Interrupts are fundamental to the OS — they enable multiprogramming, I/O, system calls, and real-time response.

53. What is a system call in an operating system?

  1. A telephone call made by the system administrator to report software bugs
  2. A programmatic interface that allows user-space programs to request services from the OS kernel — such as file I/O, process creation, memory allocation, and network communication
  3. A method for one OS to communicate with another OS in a distributed system
  4. A built-in function in a programming language that calls OS-specific features

Answer : B
Explanation: System calls are the interface between user programs and the OS kernel. Since user programs run in user mode (restricted privileges), they cannot directly access hardware or kernel data structures. System calls switch execution to kernel mode to perform privileged operations. Categories: Process control (fork, exec, exit, wait), File management (open, read, write, close, delete), Device management (ioctl, read, write for devices), Information maintenance (getpid, time, alarm), and Communication (pipe, socket, send, receive). Examples: In C, open(), read(), write() are wrappers around Linux system calls. Windows uses WinAPI functions like CreateProcess(), ReadFile().

54. What is the producer-consumer problem in operating systems?

  1. A scheduling conflict between CPU-intensive and I/O-intensive processes
  2. A classic synchronization problem where producer processes generate data into a shared buffer and consumer processes remove data — requiring synchronization to prevent buffer overflow, underflow, and race conditions
  3. A memory management conflict between producers of page faults and consumers of RAM
  4. A resource allocation problem between kernel processes and user processes

Answer : B
Explanation: The Producer-Consumer (Bounded Buffer) problem is a classic synchronization challenge. Producers create items and add them to a fixed-size shared buffer. Consumers remove items from the buffer. Problems to solve: Producers must wait if the buffer is full, Consumers must wait if the buffer is empty, and Only one process should access the buffer at a time (mutual exclusion). Solution using semaphores: empty (initialized to buffer size — counts empty slots), full (initialized to 0 — counts full slots), mutex (initialized to 1 — provides mutual exclusion). This pattern appears in operating systems (I/O buffers), web servers (request queues), and pipeline architectures.

55. What is the dining philosophers problem in operating systems?

  1. A problem about optimizing the dining hall scheduling for computer science students
  2. A classic synchronization problem illustrating deadlock and starvation: five philosophers sit at a round table, alternating between thinking and eating — each needs two chopsticks (shared with neighbors) to eat, potentially causing deadlock if all pick up their left chopstick simultaneously
  3. A CPU scheduling challenge involving five different priority levels for OS processes
  4. A memory allocation problem involving five competing processes and five memory blocks

Answer : B
Explanation: The Dining Philosophers Problem, proposed by Dijkstra, illustrates deadlock and starvation in concurrent systems. 5 philosophers sit at a round table with 5 chopsticks between them. To eat, a philosopher needs both adjacent chopsticks. If all philosophers simultaneously pick up their left chopstick and wait for the right one, deadlock occurs. Solutions: Allow at most 4 philosophers at the table simultaneously, Use an asymmetric rule (odd-numbered pick left first; even pick right first), Use a waiter (allow a philosopher to pick up chopsticks only if both are available), or Use a monitor with a condition check. This problem demonstrates real-world concurrent resource sharing challenges.

56. What is the difference between multiprogramming and multitasking in operating systems?

  1. Multiprogramming uses multiple CPUs; multitasking uses only one CPU
  2. Multiprogramming keeps multiple programs in memory simultaneously to maximize CPU utilization; multitasking rapidly switches between processes on a single CPU giving the illusion of parallelism
  3. Multitasking is an older technique; multiprogramming is used only in modern systems
  4. Both multiprogramming and multitasking describe identical OS capabilities

Answer : B
Explanation: Multiprogramming: multiple programs are loaded into memory simultaneously. When one process blocks (for I/O), the CPU switches to another ready process — maximizing CPU utilization. The goal is to keep the CPU busy at all times. No time-sharing — a process runs until it blocks or completes. Multitasking (Time-Sharing): extends multiprogramming by adding rapid process switching based on time (time quantum). Gives each user the illusion that they have dedicated CPU access. Context switching happens so fast (milliseconds) that users experience interactive response. Modern OS combines both: multiple processes in memory (multiprogramming) with time-sliced CPU sharing (multitasking).

57. What is context switching in an operating system?

  1. Switching the operating system from one hardware platform to another
  2. The process of saving the state of a currently running process (context) and restoring the state of the next scheduled process, enabling the CPU to switch between processes
  3. Switching between user context (normal apps) and system context (OS services)
  4. The process of converting a program from one programming language to another

Answer : B
Explanation: Context switching is the mechanism that enables multitasking. When the OS decides to switch from Process A to Process B: Save Process A’s context (PC, CPU registers, memory management info, process state) into its PCB (Process Control Block), Load Process B’s context from its PCB into the CPU registers, Resume executing Process B. Context switching has overhead — pure CPU time is wasted during the switch. Context switch time: typically 1-1000 microseconds. Frequent context switches (due to small time quanta in Round Robin) increase overhead. Modern CPUs support fast context switching through hardware-assisted state saving. Context switching is also triggered by system calls and interrupts.

58. What is a Process Control Block (PCB) in an operating system?

  1. A physical hardware component that controls the CPU’s processing speed
  2. A data structure maintained by the OS for each process, containing all information needed to manage and resume the process — including process state, PID, program counter, CPU registers, memory limits, and I/O status
  3. A block of memory reserved for the operating system kernel’s control functions
  4. A control panel application that manages process priorities in Windows

Answer : B
Explanation: The Process Control Block (PCB) — also called Task Control Block — is the OS’s representation of a process. It contains: Process State (new, ready, running, waiting, terminated), Process ID (PID), Program Counter (address of next instruction), CPU Registers (all register values saved during context switch), Memory Management Information (page table, segment table, base/limit registers), CPU Scheduling Information (priority, pointers to scheduling queues), I/O Status Information (list of open files, I/O devices allocated), and Accounting Information (CPU time used, time limits). The PCB is created when a process is created and deleted when it terminates. All PCBs are stored in the Process Table.

59. What is spooling in an operating system?

  1. A technique for winding magnetic tape used to store OS backup files
  2. Simultaneous Peripheral Operations OnLine — a technique where data is temporarily buffered on disk (spool) for slow I/O devices like printers, allowing the CPU to continue other work without waiting
  3. A network protocol for synchronizing process execution across distributed systems
  4. A memory allocation technique that pre-spools (pre-allocates) memory for processes

Answer : B
Explanation: Spooling (Simultaneous Peripheral Operations OnLine) is a buffering technique for managing slow I/O devices. Example: When a user prints a document, the data is written to a disk spool (print queue) rather than directly to the printer. The CPU returns to other tasks immediately, while the OS gradually feeds data to the slow printer in the background. Multiple print jobs can be queued and printed in order. This allows the fast CPU to be “decoupled” from slow peripheral devices. Spooling is used for: printers, tape drives, and batch processing systems. The key benefit is that the CPU does not wait idle for slow devices.

60. What is the difference between logical and physical addresses in OS memory management?

  1. Logical addresses are used by hardware; physical addresses are used by software
  2. A logical address is generated by the CPU (virtual address in the process’s address space); a physical address is the actual location in RAM — the MMU translates logical to physical addresses
  3. Physical addresses are larger than logical addresses in all memory architectures
  4. Both logical and physical addresses refer to the same memory location in modern systems

Answer : B
Explanation: Logical Address (Virtual Address): generated by the CPU during program execution. It is the address the process “thinks” it is using. Each process has its own logical address space starting from 0. Physical Address: the actual location in physical RAM where data is stored. It is what the memory hardware works with. The Memory Management Unit (MMU) translates logical addresses to physical addresses at runtime using page tables (in paging), segment tables (in segmentation), or both. This translation provides: process isolation (each process has its own logical space), memory protection (processes cannot access each other’s physical memory), and flexibility (processes can be loaded anywhere in physical memory).