Q: 1 A process executes the following code
for(i=0;i<p;i++)
{
fork();
}
Total number of child process created.
1
p
2p-1
2p
[ 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: 2 There are three processes in the ready queue. When the currently running process requests for I/O how many process switches take place?
1
2
3
0
[ 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: 3 In operating system, response time is:
The total time taken from the submission time till the completion time
The time taken from the submission time till the first response is produced
The total time taken from submission time till final output is produced
None of these
[ 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: 4 Cascading termination refers to termination of all child processes, if the parent process terminates –
Normally or Abnormally
Abnormally
Normally
None of the mentioned
[ 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: 5 The state of a process after it encounters an I/O instruction is ______________?
Ready
Blocked
Idle
Running
[ 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: 6 Operating 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?
The parent continues to execute concurrently with its children
The parent waits until some or all of its children have terminated
The parent waits for the child process by issuing a signal() system call
Both (a) and (b)
[ Option D ]
When a parent process creates a child process, two situations are possible depending on the program design.
Q: 7 Information about each process in operating system is maintained by ___________.
Scheduler
Process Control Block
Central Processing Unit
Program Counter
[ 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: 8 When a process is in a "Blocked" state it waits for some I/O service. When the service is completed it goes to the-
Terminated state
Suspended state
Running state
Ready state
[ 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: 9 Consider 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 :
b = 3 and c = 5
b = 5 and c = 3
b = 3 and c = 4
b = 4 and c = 3
[ Option A ]
Q: 10 Which of the following is saved during a context switch?
Only the process ID
CPU register values, memory information and process state
Network status and battery level
Only the process priority
[ 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: 11 When a process is operating in low memory allocation and has high page fault rate, this process spends lot of time in
Running State
Pending State
Blocked State
Ready State
[ 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: 12 The switching of the CPU from one process or thread to another is called ___________.
Process Switch
Task Switch
Context Switch
None of the above
[ 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.
Q: 13 Which of the following transitions is not possible between the process states shown below?
Run → Ready
Run → Terminated
Run → Waiting
Waiting → Run
[ Option D ]
In an operating system, a process moves through states such as Ready, Run (Running), Waiting (Blocked), and Terminated.
However, a process in the Waiting state cannot directly move to the Run state. When the event or I/O it is waiting for completes, it first moves to the Ready state, and then the scheduler may select it to move to the Run state.
Q: 14 Consider the following statement –
(i) A child process that remains running even after its parent process is terminated or completed without waiting for the child process execution is called an orphan.
(ii) A process that has completed its task but still, it shows an entry in a process table is called a zombie process.
Both are True
Both are False
Only I is True
Only II is True
[ Option A ]
Orphan Process:
In operating systems, when a parent process terminates before its child process completes, the child process is still running. Such a child process is called an orphan. Typically, the orphan process is adopted by the init process, ensuring proper cleanup when it finishes.
Zombie Process:
A zombie process is a process that has finished execution but still appears in the process table because its parent process has not yet collected its exit status via the wait() system call. Zombie processes do not consume CPU resources but occupy a slot in the process table until the parent collects the exit information.
Q: 15 The Kernel dispatcher keeps track of all _________ threads and schedules them in priority order.
Ready
Standby
Running
Waiting
[ Option A ]
In an Operating System (OS), the kernel dispatcher (scheduler) is responsible for managing CPU time among different threads or processes. It decides which thread should run next based on their state and priority.
Threads in an OS can be in different states such as Ready, Running, Waiting (Blocked), or Terminated. The Ready state means that the thread is prepared to run and is waiting for CPU allocation.
The Kernel dispatcher maintains a Ready Queue, which contains all the ready threads. It selects one thread from this queue based on priority and assigns it the CPU.
Q: 16 Consider a multi-programmed system with a degree of 6 (i.e. six programs in memory at the same time). Assume that each process spends 40% of its time waiting for I/O. What will be the CPU utilization?
0.04096
0.999555
0.995904
0.994646
[ Option C ]
In a multiprogramming system, CPU is idle only when all processes are waiting for I/O simultaneously.
Formula for CPU Utilization: 1−pn
Where:
Given:
Probability all processes are waiting: (0.4)6 = 0.004096
CPU Utilization: 1-0.004096 = 0.995904
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.