CPU Scheduling Questions with Answers

58 practice questions on CPU Scheduling (Operating Systems) with answers and step-by-step solutions. Try 10 samples below, then practise all 58 free in the AptiNest app.

Sample questions

Question 1Easy

If all processes arrive at the same time, which non-preemptive algorithm gives the minimum average waiting time?

  1. First-Come, First-Served
  2. Shortest Job First (SJF)
  3. Round Robin
  4. Priority scheduling with random priorities

Answer: B. Shortest Job First (SJF)

Explanation

Running shorter jobs first is provably optimal for average waiting time when all jobs are available at once.

Step-by-step solution

  1. SJF runs the shortest job first, so short jobs do not wait behind long ones.
  2. When all jobs arrive together, SJF gives the lowest average waiting time among non-preemptive algorithms.
  3. So the answer is Shortest Job First (SJF).

Why the other options are wrong

  • A. FCFS makes short jobs wait behind long early ones, so its average waiting is higher.
  • C. Round Robin gives each job time slices, which adds waiting for most jobs.
  • D. Random priorities are not chosen to minimise waiting, so the average is not the lowest.

Tip: Shortest job first minimises the average waiting time.

Question 2Easy

Three processes arrive at time 0 in the order P1, P2, P3 with CPU bursts 24, 3 and 3 ms. What is the average waiting time under FCFS?

  1. 3 ms
  2. 10 ms
  3. 27 ms
  4. 17 ms

Answer: D. 17 ms

Explanation

Waiting times: P1 = 0, P2 = 24, P3 = 27.
Average = (0 + 24 + 27) / 3 = 17 ms.

Step-by-step solution

  1. Order P1, P2, P3. P1 starts at 0, waits 0 ms and runs 24 ms.
  2. P2 starts at 24 and waits 24 ms. P3 starts at 27 and waits 27 ms.
  3. Total waiting is 0 + 24 + 27 = 51 ms. The average is 51 ÷ 3 = 17 ms, the correct answer.

Why the other options are wrong

  • A. 3 ms is the burst of P2 or P3, not the average waiting time.
  • B. 10 ms does not match the waits 0, 24 and 27, which average 17 ms.
  • C. 27 ms is only P3's waiting time, not the average over the three processes.

Tip: FCFS: each job waits for all the bursts before it; the average is total waiting ÷ number of jobs.

Question 3Easy

In which kind of scheduling can the OS take the CPU away from a running process before it finishes its burst?

  1. Non-preemptive scheduling
  2. Batch scheduling
  3. Preemptive scheduling
  4. Cooperative scheduling

Answer: C. Preemptive scheduling

Explanation

Preemptive scheduling may interrupt a running process (e.g. on a timer interrupt or a higher-priority arrival).

Step-by-step solution

  1. Preemptive scheduling allows the OS to pause a process mid-burst.
  2. The CPU can be taken away even if the process hasn't finished.
  3. This is done for time-sharing or priority reasons.
  4. Example: Timer interrupt stops a process to let another run.
  5. Final answer: Preemptive scheduling.

Why the other options are wrong

  • A. Non-preemptive scheduling lets a process keep the CPU until it blocks or finishes, so the OS cannot take it away.
  • B. Batch scheduling describes how jobs are grouped and run without interaction; it does not decide whether the CPU can be taken away.
  • D. Cooperative scheduling relies on processes giving up the CPU voluntarily, so the OS cannot take it away mid-burst.

Tip: Remember: Preemptive scheduling means the OS can interrupt a process at any time.

Question 4Easy

What happens to Round Robin scheduling when the time quantum is made very large (larger than every burst)?

  1. It behaves like FCFS
  2. Every process starves
  3. It behaves like priority scheduling
  4. It behaves like SJF

Answer: A. It behaves like FCFS

Explanation

If the quantum exceeds every CPU burst, no process is ever preempted, so processes simply run in arrival order, which is FCFS.

Step-by-step solution

  1. Time quantum > all bursts means no preemption occurs.
  2. Processes run to completion without being interrupted.
  3. This matches the behavior of First Come First Served (FCFS).
  4. Final answer: It behaves like FCFS.

Why the other options are wrong

  • B. No process starves when the quantum is large; each process simply runs to completion in turn.
  • C. Priority scheduling depends on priorities, and a large quantum does not introduce any priority order.
  • D. SJF picks the shortest job first; a huge quantum just runs jobs in arrival order, which is FCFS.

Tip: Large time quantum in Round Robin = FCFS behavior.

Question 5Medium

The medium-term scheduler is mainly associated with:

  1. Choosing the next process to run on the CPU
  2. Handling hardware interrupts and dispatching them to device drivers
  3. Admitting batch jobs from disk
  4. Swapping processes out of and back into memory

Answer: D. Swapping processes out of and back into memory

Explanation

The medium-term scheduler temporarily removes (swaps out) processes to reduce memory pressure and later swaps them back in.

Step-by-step solution

  1. Medium-term scheduler manages memory by removing processes.
  2. It swaps processes out of memory to free space.
  3. Swapped-out processes are stored on disk temporarily.
  4. Later, it brings them back into memory when needed.
  5. This process is called swapping.

Why the other options are wrong

  • A. Choosing the next process for the CPU is the short-term scheduler's job, not the medium-term scheduler's.
  • B. Handling hardware interrupts and dispatching to device drivers is the job of interrupt handling, not this scheduler.
  • C. Admitting batch jobs from disk is the long-term scheduler's role, not the medium-term scheduler's.

Question 6Medium

Processes P1 (burst 8), P2 (burst 5) and P3 (burst 3) arrive at time 0 in that order. With Round Robin and a quantum of 4 ms, when does P2 finish?

  1. 16 ms
  2. 12 ms
  3. 9 ms
  4. 15 ms

Answer: A. 16 ms

Explanation

Timeline: P1 0-4, P2 4-8, P3 8-11, P1 11-15, P2 15-16, so P2 completes at 16.

Step-by-step solution

  1. Quantum is 4 ms. Slices run in order: P1 0-4, P2 4-8, P3 8-11 (P3 finishes), P1 11-15 (P1 finishes).
  2. P2 has 1 ms left after its first slice, so it runs again from 15 to 16.
  3. P2 finishes at 16 ms, which is option A.

Why the other options are wrong

  • B. 12 ms is too early; P2 still needs a second slice after P1 finishes at 15 ms.
  • C. 9 ms is too early; P2 only has its first slice done at 8 ms.
  • D. 15 ms is when P2 starts its last slice, not when it finishes; it ends 1 ms later.

Tip: With RR, a process finishes only when its last slice ends, and every other ready process gets a slice first.

Question 7Medium

Using FCFS, what is the average turnaround time for these processes (times in ms)?

Process  Arrival  Burst
P1       0        4
P2       1        3
P3       2        1
P4       3        2
  1. 5.5 ms
  2. 5.75 ms
  3. 7.5 ms
  4. 4 ms

Answer: B. 5.75 ms

Explanation

Completion times: P1 = 4, P2 = 7, P3 = 8, P4 = 10.
Turnaround = completion - arrival: 4, 6, 6, 7.
Average = 23 / 4 = 5.75 ms.

Step-by-step solution

  1. FCFS order is arrival order.
  2. Completion: P1 4, P2 7, P3 8, P4 10.
  3. Turnaround = completion - arrival: 4, 6, 6, 7.
  4. Average = 23/4 = 5.75 ms.

Why the other options are wrong

  • A. 5.5 ms is not the average of 4,6,6,7.
  • C. 7.5 ms is not the result of the FCFS schedule.
  • D. 4 ms ignores waiting and uses neither mean.

Tip: TAT = CT - AT; WT = TAT - BT.

Question 8Medium

Using non-preemptive priority scheduling (lower number = higher priority), what is the average waiting time (times in ms)?

Process  Arrival  Burst  Priority
P1       0        4      3
P2       1        3      1
P3       2        5      4
P4       3        2      2
  1. 4.25 ms
  2. 7 ms
  3. 3.5 ms
  4. 3.25 ms

Answer: C. 3.5 ms

Explanation

Gantt chart: P1 0-4, P2 4-7, P4 7-9, P3 9-14.
Completion times: P1=4, P2=7, P3=14, P4=9.
Waiting (TAT - burst): 0, 3, 7, 4;
average = 14/4 = 3.5 ms.

Step-by-step solution

  1. Non-preemptive: P1 starts at 0 (only process ready) and runs 0-4.
  2. At 4 ready are P2 (priority 1), P3 (4) and P4 (2). P2 runs 4-7.
  3. P4 (priority 2) runs 7-9, then P3 (priority 4) runs 9-14.
  4. Waiting = start minus arrival: P1 0, P2 3, P4 4, P3 7.
  5. Average = (0 + 3 + 4 + 7) ÷ 4 = 3.5 ms, which is option C.

Why the other options are wrong

  • A. 4.25 ms needs a total of 17 ms; the waiting times add up to 14 ms.
  • B. 7 ms is only P3's waiting time, not the average.
  • D. 3.25 ms needs a total of 13 ms; P3 alone waits 7 ms, so the total is 14 ms.

Tip: In non-preemptive priority, a running job is never interrupted; pick the highest-priority ready job each time one ends.

Question 9Hard

Using SRTF scheduling, what is the average turnaround time (times in ms)?

Process  Arrival  Burst
P1       0        8
P2       2        3
P3       3        7
P4       6        1
  1. 11.25 ms
  2. 3.25 ms
  3. 8 ms
  4. 9.25 ms

Answer: C. 8 ms

Explanation

Gantt chart: P1 0-2, P2 2-5, P1 5-6, P4 6-7, P1 7-12, P3 12-19.
Completion times: P1=12, P2=5, P3=19, P4=7.
Turnaround (CT - arrival): 12, 3, 16, 1;
average = 32/4 = 8 ms.

Step-by-step solution

  1. Gantt: P1 0-2, P2 2-5, P1 5-6, P4 6-7, P1 7-12, P3 12-19.
  2. Completion: P1 12, P2 5, P3 19, P4 7.
  3. TAT: 12, 3, 16, 1; sum 32.
  4. Average = 32/4 = 8 ms.

Why the other options are wrong

  • A. 11.25 ms is not the SRTF result.
  • B. 3.25 ms is not a turnaround value for this set.
  • D. 9.25 ms wrongly keeps P1 running.

Question 10Hard

Which scheduling algorithm is preferred to favour I/O-bound and interactive processes automatically without knowing burst lengths?

  1. Non-preemptive Priority
  2. Multilevel Feedback Queue
  3. Largest Job First
  4. FCFS

Answer: B. Multilevel Feedback Queue

Explanation

MLFQ demotes processes that use whole quanta (CPU-bound) and keeps short-burst I/O-bound processes in high-priority queues.

Step-by-step solution

  1. A Multilevel Feedback Queue moves a process down when it uses its full quantum (CPU-bound) and keeps I/O-bound jobs at high levels.
  2. It needs no knowledge of burst lengths, so it favours interactive jobs automatically.
  3. The answer is option B.

Why the other options are wrong

  • A. Non-preemptive priority needs priorities set in advance and does not adapt to I/O behaviour.
  • C. Largest Job First favours long jobs, the opposite of the goal.
  • D. FCFS gives no preference to interactive or I/O-bound jobs.

Tip: MLFQ rewards short bursts and I/O waits by staying at high-priority queues, and drops CPU-heavy jobs down.

Practise all 58 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Operating Systems topics · All topics