Operating System MCQ (Multiple Choice Questions and Answers)

71. What is the difference between a process and a program?

  1. A program is always larger than a process in terms of memory usage
  2. A program is a static set of instructions stored on disk; a process is a program in execution — a dynamic entity with its own memory space, resources, and state
  3. A process can exist without a program; a program always requires a running process
  4. Programs run in kernel mode; processes run in user mode

Answer : B
Explanation: A Program is a passive entity — a file containing instructions stored on disk (executable file). It has no concept of execution state, memory allocation, or CPU usage. A Process is an active entity — a program currently being executed. It includes: the program code (text section), current activity (program counter, registers), stack (temporary data — function parameters, return addresses, local variables), data section (global variables), and heap (dynamically allocated memory). One program can give rise to multiple processes (e.g., opening multiple Chrome windows creates multiple Chrome processes). A process is the fundamental unit of work in an OS.

72. What is multithreading in an operating system?

  1. Running multiple copies of the same program simultaneously on different computers
  2. The ability of a CPU or OS to execute multiple threads concurrently within a single process, sharing the process’s resources while running different execution paths simultaneously
  3. A technique of using multiple hard drives to increase disk read/write speed
  4. Using multiple monitors to display different OS windows simultaneously

Answer : B
Explanation: Multithreading allows a single process to perform multiple tasks concurrently. Benefits: improved CPU utilization (one thread runs while another waits for I/O), better responsiveness (GUI thread stays responsive while background thread processes), resource sharing (threads share code, data, heap — more memory efficient than multiple processes), and easier communication (no IPC needed between threads of the same process). Thread models: Many-to-One (many user threads mapped to one kernel thread — not truly parallel), One-to-One (each user thread maps to a kernel thread — true parallelism), Many-to-Many (flexible mapping). Examples: web servers use threads for each request; web browsers use threads for tab rendering, JavaScript execution, and UI.

73. What is memory-mapped I/O in operating systems?

  1. A technique of storing I/O device data in files mapped to disk storage
  2. A technique where I/O device registers are mapped into the same address space as regular memory, allowing the CPU to communicate with devices using normal memory read/write instructions
  3. A method of mapping main memory contents to virtual memory for swap operations
  4. A technique of allocating memory regions for inter-process communication

Answer : B
Explanation: Memory-Mapped I/O (MMIO) maps device control registers to specific addresses in the CPU’s address space. The CPU communicates with devices using normal load/store instructions to these addresses — no special I/O instructions needed. Advantages: simpler programming model, allows use of all CPU addressing modes, faster than port-mapped I/O for large data transfers. Used by: graphics cards (frame buffer), network cards, disk controllers, and most modern peripheral devices. Memory-Mapped Files: a related concept where a file is mapped to a region of virtual memory — reading/writing the memory reads/writes the file. Used for: fast file I/O, shared memory between processes, and executable loading.

74. What is the difference between swapping and paging in operating systems?

  1. Swapping moves files between drives; paging moves processes between applications
  2. Swapping moves an entire process between main memory and secondary storage; paging moves individual pages (fixed-size portions) between main memory and disk — paging is more efficient as only needed portions move
  3. Paging is for virtual memory; swapping is only used in batch processing systems
  4. Both swapping and paging are identical memory management techniques

Answer : B
Explanation: Swapping: the entire process is moved (swapped out) from main memory to a swap space on disk when memory is insufficient, and later swapped back in when needed. Very slow because moving a complete process is expensive. The swapped-out process cannot execute. Used in medium-term scheduling. Paging: only individual pages that are not currently needed are moved to disk (demand paging), while the rest of the process remains in memory. Much more efficient than swapping — only the needed portion moves. Allows processes larger than physical memory. Modern OS use paging rather than whole-process swapping. The page file (Windows) or swap partition (Linux) stores swapped-out pages.

75. What is the purpose of the OS bootloader?

  1. A program that loads user applications from the internet at startup
  2. A small program stored in the boot sector that loads the operating system kernel from disk into memory and transfers control to it when the computer powers on
  3. A hardware component that initializes the CPU and RAM before the OS loads
  4. A diagnostic program that checks hardware components for errors during startup

Answer : B
Explanation: The Boot Process: Power On → BIOS/UEFI firmware runs POST (Power-On Self-Test) → BIOS searches for a bootable device → loads the bootloader from the boot sector → Bootloader loads the OS kernel into RAM → Kernel initializes hardware, mounts root file system, starts init/systemd → User login. Famous bootloaders: GRUB (GRand Unified Bootloader) for Linux, Windows Boot Manager for Windows, and UEFI boot managers for modern systems. GRUB can present a menu to select between multiple OS installations (dual-booting). UEFI replaced BIOS in modern systems — it supports larger disks, faster boot times, and secure boot (preventing unauthorized OS loading).

76. What is a zombie process in an operating system?

  1. A malicious process created by a virus to consume all system resources
  2. A process that has completed execution but still has an entry in the process table because its parent has not yet read its exit status using the wait() system call
  3. A process that is permanently blocked waiting for a resource that will never be available
  4. A process running in the background without the user’s knowledge

Answer : B
Explanation: A Zombie Process (defunct process) has completed execution but remains in the process table. When a child process exits, it sends SIGCHLD to its parent and waits for the parent to call wait() to retrieve its exit status. Until the parent calls wait(), the child exists as a zombie — it uses no memory or CPU but occupies a process table slot. If the parent never calls wait(), zombie processes accumulate and can exhaust process table entries. Solution: the parent should call wait() or signal handler for SIGCHLD. If a parent terminates without calling wait(), init (PID 1) or systemd adopts orphan processes and calls wait() on their behalf.

77. What is an orphan process in an operating system?

  1. A process that has no associated program file on disk
  2. A process whose parent has terminated before the child process — the orphan is adopted by the init process (PID 1) which periodically calls wait() to prevent zombies
  3. A process that runs without any user interaction or control
  4. A process that cannot find the shared library it needs to execute

Answer : B
Explanation: An Orphan Process is a child process whose parent has terminated. When a parent dies, its child processes become orphans. In Unix/Linux, the init process (PID 1) — or systemd in modern systems — automatically adopts all orphan processes. Init periodically calls wait() to collect exit statuses of orphan children, preventing them from becoming zombies. Unlike zombie processes (which have finished but wait for parent), orphan processes are still running but have lost their parent. Intentional orphaning is used for daemon processes — processes that intentionally “detach” from their parent to run as long-running background services.

78. What is Peterson’s solution in operating systems?

  1. A disk scheduling algorithm that services requests based on Peterson’s theorem
  2. A software-based solution to the critical section problem for two processes, using two shared variables (flag array and turn variable) to ensure mutual exclusion, progress, and bounded waiting
  3. A memory allocation algorithm that assigns memory based on process priority
  4. A page replacement algorithm that replaces pages based on future access patterns

Answer : B
Explanation: Peterson’s Algorithm is a classic software solution for the two-process critical section problem. It uses two shared variables: flag[2] (flag[i] = true means process i wants to enter the critical section) and turn (indicates whose turn it is to enter). For Process i: flag[i] = true; turn = j; while (flag[j] && turn == j) wait; // critical section; flag[i] = false. This satisfies all three requirements: Mutual Exclusion, Progress, and Bounded Waiting. Limitation: works only for two processes and assumes atomic load/store operations. Modern hardware reordering may violate assumptions without memory barriers. It is primarily important as a teaching example of synchronization concepts.

79. What are the different types of operating systems?

  1. Fast, Medium, and Slow operating systems based on CPU speed requirements
  2. Batch OS, Time-Sharing OS, Distributed OS, Real-Time OS, Network OS, Embedded OS, and Mobile OS — each designed for different use cases and environments
  3. Windows, Linux, and macOS are the only three types of operating systems
  4. Single-user and multi-user are the only two types of operating systems

Answer : B
Explanation: Types of Operating Systems: Batch OS — jobs collected and processed in batches without user interaction (early IBM mainframes). Time-Sharing OS — multiple users share CPU time simultaneously (Unix, Linux). Distributed OS — manages a network of computers as a single system. Real-Time OS — responds within strict time deadlines (VxWorks, FreeRTOS). Network OS — provides network services (Novell NetWare). Embedded OS — runs on specialized hardware with limited resources (RTOS for microcontrollers). Mobile OS — designed for smartphones and tablets (Android, iOS). Multiprocessor OS — manages multiple CPUs. Each type is optimized for different constraints: response time, throughput, user count, resource availability.

80. What is the concept of memory protection in operating systems?

  1. Protecting memory chips from physical damage using protective cases
  2. Mechanisms that prevent processes from accessing memory locations that belong to other processes or the OS kernel — ensuring isolation, security, and system stability
  3. Encrypting RAM contents to protect sensitive data from physical memory attacks
  4. A backup system that creates copies of RAM contents to protect against power failures

Answer : B
Explanation: Memory Protection prevents processes from accidentally or maliciously reading or writing memory that doesn’t belong to them. Mechanisms: Base and Limit Registers — each process gets a base (starting address) and limit (size); any access outside this range generates a trap. Paging with Protection Bits — each page table entry has read/write/execute permission bits; violations cause a segmentation fault. Segmentation with permissions — similar protection at segment level. User Mode vs Kernel Mode — user processes cannot execute privileged instructions or access kernel memory directly. Memory protection is essential: without it, a buggy or malicious program could corrupt other processes or crash the OS.