Process Management MCQs for NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

Process management is how the OS creates, tracks, switches between and ends processes. A process is a program in execution, and the OS records each one in a process control block (PCB). This is topic 3 of the Operating Systems area, which carries 5% of the NSCT according to HEC's Areas of Competencies. OS had the lowest 2026 accuracy of any area, 33.8%, per the HEC NSCT report and APP.

Definitions follow Silberschatz, Operating System Concepts. A process in memory has four sections: text (code), data (global variables), heap (memory from malloc()) and stack (parameters, return addresses and local variables). A program on disk is passive. Once it is loaded and running, it is a process.

Process states

Silberschatz uses five states:

State Meaning
New Being created
Ready Waiting to be given a CPU core
Running Instructions are executing
Waiting Waiting for an event, such as I/O completion
Terminated Finished execution

The legal transitions are: new → ready (admitted), ready → running (dispatched by the scheduler), running → ready (interrupt, such as the timer), running → waiting (I/O or event wait), waiting → ready (I/O or event completion) and running → terminated (exit).

Two moves never happen directly: waiting → running and ready → waiting. A finished I/O puts a process back in the ready queue, and only a running process can ask to wait. Textbooks differ on names. Stallings says "blocked" for waiting and adds suspended states in a seven-state model.

Three schedulers act on these states. The short-term (CPU) scheduler picks from the ready queue very often. The long-term (job) scheduler admits jobs and controls the degree of multiprogramming; Silberschatz notes that UNIX and Windows have little or none. The medium-term scheduler swaps processes out and back in when memory is tight.

Exam angle: "I/O completes while another process is running." The waiting process becomes ready, not running.

PCB

The process control block is the kernel's record of one process. It holds:

In Linux the PCB is the task_struct. It lives in kernel memory, so a process cannot edit its own priority. It does not contain the stack or heap themselves.

Exam angle: "Which is NOT in the PCB?" The answer is usually the actual data (stack contents, heap, source code), not a pointer or a register value.

Context switching

A context switch saves the running process's state into its PCB and loads the next process's state from its PCB. It is pure overhead, because no process does useful work meanwhile. Hardware with several register sets makes it faster. A context switch is not the same as a mode switch. A system call enters kernel mode but may return to the same process.

Overhead matters when slices are short: a 10 ms slice with a 1 ms switch wastes 1/11, about 9.1%, while a 0.5 ms slice with a 0.5 ms switch wastes 50%. CPU Scheduling picks this up.

Exam angle: divide by the whole cycle (slice + switch), not by the slice alone.

Process creation and termination

fork() creates a child with a copy of the parent's address space. It returns 0 in the child and the child's PID in the parent (−1 on failure). exec() replaces the memory image with a new program and keeps the PID. wait() lets a parent collect a child's exit status.

Code Processes Prints
n plain fork() calls, then printf 2ⁿ 2ⁿ
fork() && fork(); 3 3
fork() \|\| fork(); 3 3
fork() && fork() \|\| fork(); 5 5
loop i < 3 with fork(); printf inside 8 2 + 4 + 8 = 14

We checked every count on this page by simulating the full fork tree in Python. Because each process has its own copy of variables, a child's x++ never changes the parent's x.

A zombie has exited, but its parent has not yet called wait(). An orphan's parent has exited; Linux and UNIX re-parent it to init (or systemd), which reaps it.

Common traps

Worked examples

Understanding. Which PCB field tells the CPU where to resume a process after a context switch? Answer: the program counter. It holds the address of the next instruction. The saved registers restore the rest of the CPU state.

Application. A loop runs fork() 4 times (for (i = 0; i < 4; i++) fork();), then calls printf("x\n"). How many times is x printed? Answer: 16. Every existing process forks in each iteration, so the count doubles 4 times: 2⁴ = 16 processes, each printing once.

Analysis. How many times does fork(); fork() && fork(); printf("x\n"); print x? Answer: 6. The first fork() gives 2 processes. Each then runs fork() && fork(), which turns 1 process into 3 (the first child short-circuits). So 2 × 3 = 6 processes print.

Practise

The quiz below has 100 Process Management questions, which you can filter by tier and difficulty.

Practise: 100 questions

Interactive quiz loading. The first 10 questions are shown below.

  1. According to Silberschatz, what is a process?

    1. An executable file stored on disk
    2. A single CPU instruction
    3. A block of memory allocated by malloc()
    4. A program in execution
    Show answer

    Answer: D. A program in execution

    A process is a program in execution: an active entity with a program counter, registers, stack, data and heap. A program on its own is a passive entity, such as an executable file; it becomes a process when it is loaded into memory and run.

  2. Which list gives the five process states in Silberschatz's process-state diagram?

    1. New, ready, running, waiting, terminated
    2. New, ready, running, blocked, suspended
    3. Created, scheduled, running, sleeping, zombie
    4. Ready, running, waiting, swapped, terminated
    Show answer

    Answer: A. New, ready, running, waiting, terminated

    Silberschatz uses new, ready, running, waiting and terminated. Stallings calls waiting 'blocked' and adds suspended states in a seven-state model, and Linux has its own state names, so watch which textbook a question follows.

  3. Which of these is NOT normally stored in a process control block (PCB)?

    1. The full contents of the process's stack and heap
    2. The program counter
    3. The saved CPU registers
    4. The list of files the process has open
    Show answer

    Answer: A. The full contents of the process's stack and heap

    The PCB holds the information needed to manage and resume a process: state, program counter, CPU registers, scheduling information, memory-management information (such as page-table pointers), accounting data and I/O status like open files. The stack and heap themselves live in the process's memory, not in the PCB.

  4. A running C program calls malloc() to get memory at run time. In which section of the process's memory layout is that memory allocated?

    1. Stack
    2. Text section
    3. Data section
    4. Heap
    Show answer

    Answer: D. Heap

    The heap holds memory allocated dynamically during run time. The stack holds temporary data such as function parameters, return addresses and local variables; the text section holds code; and the data section holds global variables.

  5. What value does fork() return in the newly created child process?

    1. The child's own process ID
    2. The parent's process ID
    3. 0
    4. -1
    Show answer

    Answer: C. 0

    fork() returns twice. In the child it returns 0; in the parent it returns the child's (positive) PID. It returns -1 to the parent only if the fork fails, in which case no child exists.

  6. What does a successful call to exec() (for example execlp()) do?

    1. Creates a new child process that runs the new program
    2. Waits for a child process to finish
    3. Replaces the calling process's memory image with a new program, keeping the same PID
    4. Terminates the calling process and returns its status to the parent
    Show answer

    Answer: C. Replaces the calling process's memory image with a new program, keeping the same PID

    exec() loads a new program into the current process's address space, destroying the old memory image, and starts executing it. The process ID does not change. Creating a new process is fork()'s job; in UNIX the usual pattern is fork() followed by exec() in the child.

  7. What is a zombie process?

    1. A process whose parent has terminated
    2. A process stuck in an infinite loop
    3. A process that has terminated but whose parent has not yet called wait() to collect its exit status
    4. A process that has been swapped out to disk
    Show answer

    Answer: C. A process that has terminated but whose parent has not yet called wait() to collect its exit status

    When a process exits, its resources are freed but its entry in the process table stays until the parent calls wait(), because the entry holds the exit status. In that window the process is a zombie. A process whose parent has died is an orphan, which is a different case.

  8. On traditional UNIX and Linux, what happens to a child process whose parent terminates without calling wait()?

    1. It becomes an orphan and is adopted by init (or systemd), which later reaps it
    2. It is always terminated immediately
    3. It becomes a zombie forever
    4. It takes over its parent's PID
    Show answer

    Answer: A. It becomes an orphan and is adopted by init (or systemd), which later reaps it

    Silberschatz explains that orphans are assigned to the init process (systemd on many modern Linux systems, or another reaper process), which periodically calls wait(). That lets the orphan's exit status be collected and its process-table entry released.

  9. What is a context switch?

    1. Moving a process from main memory to disk
    2. Changing the mode bit from user mode to kernel mode
    3. Saving the state of the current process in its PCB and loading the saved state of another process
    4. Creating a new process with fork()
    Show answer

    Answer: C. Saving the state of the current process in its PCB and loading the saved state of another process

    Switching the CPU to another process requires a state save of the current process and a state restore of the next one, both using their PCBs. A mode switch into the kernel alone is not a context switch; the kernel may return to the same process.

  10. Which scheduler selects a process from the ready queue and allocates a CPU core to it?

    1. The long-term (job) scheduler
    2. The medium-term scheduler
    3. The disk scheduler
    4. The short-term (CPU) scheduler
    Show answer

    Answer: D. The short-term (CPU) scheduler

    The short-term or CPU scheduler picks among processes that are ready to run and gives one the CPU. It runs very often, at least once every 100 milliseconds, so it must be fast. The dispatcher then actually hands over control.

FAQs

What is the difference between a process and a program?

A program is a passive entity, an executable file stored on disk. A process is an active entity: the program loaded into memory with its own program counter, registers, stack, heap and PCB. One program can give rise to many processes. For example, three users running the same editor create three processes.

What is the difference between a zombie and an orphan process?

A zombie has finished, but its parent has not yet called wait(), so its process-table entry and exit status remain. An orphan is still running, but its parent has exited. Linux and UNIX re-parent orphans to init or systemd, which calls wait() when they finish, so they do not stay zombies.

Why does fork() return two different values?

After fork() there are two processes running the same code, and each needs to know which one it is. The child receives 0, and the parent receives the child's PID so it can track or wait for that child. Testing if (fork() == 0) is the standard way to give the child different work.

Is a context switch the same as switching to kernel mode?

No. A mode switch happens on every system call or interrupt, and the kernel may return to the same process. A context switch happens only when the CPU moves to a different process. Every context switch involves kernel mode, but most mode switches are not context switches.

Next step

Continue with CPU Scheduling MCQs, go back to the Operating Systems hub, or try a timed NSCT mock test.