This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1A process executes the following code
for(i=0;i<p;i++)
{
fork();
}
Total number of child process created.
Option C
The fork() System Call creates a new child process. After each fork(), both the parent and the newly created child continue executing the next iterations of the loop.
for(i=0; i<p; i++)
{
fork();
}
In the above given loop, at each iteration, the number of processes doubles.
| Iteration | Total Processes | Child Processes |
|---|---|---|
| Initially | 1 (Only Parent) | 0 |
| After 1st fork() | 2 | 2-1=1 |
| After 2nd fork() | 4 | 4-1=3 |
| After 3rd fork() | 8 | 8-1=7 |
| After 4th fork() | 16 | 16-1=15 |
| After p iterations | 2p | 2p-1 |
Q: 2There are three processes in the ready queue. When the currently running process requests for I/O how many process switches take place?
Option A
A Process Switch (Context Switch) occurs when the CPU changes from one process to another. When the currently running process requests an I/O operation, it cannot continue execution, so it moves to the blocked state.
At this point, the CPU selects one process from the ready queue and starts executing it. This results in only one context switch, from the running process to the next ready process.
Even though there are three processes in the ready queue, only one process is selected at a time, so only one switch occurs.
Q: 3In operating system, response time is:
Option B
In operating systems, different time metrics are used to evaluate process performance.
Response Time refers to the time interval between when a process is submitted and when it first starts responding i.e., produces the first output or gets CPU for the first time. It does not consider the completion of the process.
Q: 4Cascading termination refers to termination of all child processes, if the parent process terminates –
Option A
Cascading termination refers to the situation where the termination of a parent process leads to the automatic termination of all its child processes. This mechanism is implemented by the operating system to avoid the creation of orphan processes, which are child processes left without a parent to manage them.
Importantly, cascading termination occurs regardless of whether the parent process terminates normally after completing its execution or abnormally due to an error or external interruption. This policy helps maintain system stability by cleaning up all associated child processes when the parent ends.
Q: 5The state of a process after it encounters an I/O instruction is ______________?
Option B
In an Operating System, a process changes its state based on its activity. When a process is executing and encounters an I/O instruction like reading from a file or waiting for input, it cannot continue execution until the I/O operation is completed.
At this point, the process moves from the running state to the Blocked or Waiting state because it is waiting for the I/O operation to finish. Once the I/O is completed, the process moves back to the Ready State.
Q: 6Suppose that a process is in ‘BLOCKED’ state waiting for some I/O service. When the service is completed, it goes to the _________ state.
Option B
A process passes through different states during its execution. The operating system uses these states to manage CPU allocation and process execution. The most common process states are New, Ready, Running, Blocked (Waiting), and Terminated.
When a process requests an I/O operation (such as reading a file or receiving input from a keyboard), it cannot continue execution until the I/O operation is completed. Therefore, the process enters the Blocked (Waiting) state.
Once the I/O operation is completed, the process does not immediately get the CPU. Instead, it moves to the Ready state, where it waits for the CPU scheduler to assign the CPU.
Process State:
New
↓
Ready
↓
Running
↓
Blocked (Waiting for I/O)
↓
Ready
↓
Running
↓
Terminated
Q: 7Operating system must provide a mechanism for parent processes to create new child processes. Which of the following statements is true when a parent process creates new process?
Option D
When a parent process creates a child process, two situations are possible depending on the program design.
Q: 8Information about each process in operating system is maintained by ___________.
Option B
An operating system manages multiple processes simultaneously. To keep track of each process, the operating system stores all important information related to the process in a special data structure called the Process Control Block (PCB).
PCB contains information such as:
Whenever the CPU switches from one process to another, the operating system uses the PCB to save and restore process information.
Q: 9A process is a(n) ___________ entity, whereas a program is a(n) __________ entity.
Option C
In an operating system, a program and a process are closely related concepts, but they are not the same.
A program is a set of instructions stored on a storage device, whereas a process is the actual execution of those instructions.
A program is a passive entity because it is simply a collection of instructions stored in a file. It does not perform any action by itself.
A process is an active entity because it is a program that is currently being executed by the CPU. A process has its own state, program counter, registers, memory allocation, and other resources.
Q: 10Which one of the following is not a condition for process state transition from running state to wait state?
Option C
In an Operating System (OS), a process changes from the running state to the waiting state when it cannot continue execution until some event occurs. This usually happens when the process needs an external operation or resource.
A running process moves to the wait state in situations such as:
If a higher priority process arrives, the current process may move from Running State to Ready State, not to waiting state.
A Lower Priority process does not affect the currently running process.
Q: 11When a process is in a "Blocked" state it waits for some I/O service. When the service is completed it goes to the-
Option D
When a process is in the Blocked State, it is waiting for some I/O service or resource to become available. Once the I/O operation or the required event is completed, the process cannot immediately start executing because the CPU may currently be busy with other processes. Therefore, it transitions to the Ready State.
Q: 12Consider two processes, P3 and P4, that share global variables b and c, with initial values b = 1 and c = 2. At some point in its execution, P3 executes the assignment b = b + c, and at some point in its execution, P4 executes the assignment c = b + c. if P3 executes its assignment statement first, then the final values of b and c are :
Option A
Q: 13Which of the following is saved during a context switch?
Option B
A context switch occurs when the CPU switches from executing one process (or thread) to another.
During this switch, the state (context) of the currently running process must be saved so that it can resume later exactly where it left off. The new process’s context is then loaded so that it can continue its execution.
The context of a process is stored in a special data structure called the Process Control Block (PCB).
The system saves all the information required to restart the process later, including, CPU Register Values (like program counter, accumulator, etc.), Process State (e.g., ready, waiting, running), Memory Management Information (base and limit registers, page tables, etc.)
This ensures that when the process resumes, it continues execution from the exact same point.
Q: 14When a process is operating in low memory allocation and has high page fault rate, this process spends lot of time in
Option C
In an operating system, when a process is given low memory allocation, it does not have enough pages in main memory. As a result, it frequently tries to access pages that are not present in memory, leading to a high page fault rate.
A Page Fault occurs when the required page is not in memory and must be fetched from disk. During this time, the process cannot continue execution and has to wait until the page is loaded. Hence, the process is moved to the Blocked (Waiting) State.
Q: 15The switching of the CPU from one process or thread to another is called ___________.
Option C
In an Operating System, when the CPU moves from executing one process or thread to another, it must save the current state like registers, program counter, etc. and load the state of the next process. This complete operation is called a Context Switch.
It ensures that each process resumes execution from where it was paused, maintaining proper multitasking.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.