SJF and SRTF Scheduling MCQs: 11 Solved Questions with Step-by-Step Explanations

Solve 11 SJF and SRTF questions with ready-queue decisions, Gantt traces, waiting-time calculations and checked explanations.

KnowledgeGate Team

Exam prep & CS education

Updated 7 Oct 20267 min read81 views

SJF and SRTF questions are rarely hard because of definitions, but marks are lost when you compare an original burst instead of remaining time, schedule a process before it arrives, or count a completion as a context switch. Secure the definitions, minimum-average-waiting rule, throughput logic, starvation behaviour, equal-burst behaviour, SJF waiting-time method and SRTF switch trace. Attempt each question before reading the explanation, and for every numerical, write a ready-queue snapshot at each arrival or completion. Use the SJF and SRTF PYQ practice hub for further practice. Questions 4, 5 and 9 below link directly to their original GATE pages; the other eight are explained in full here.

SJF versus SRTF: the decision rule to use before solving

Non-preemptive SJF chooses the ready process with the smallest total burst when the CPU becomes free, then lets it finish. SRTF re-evaluates at every arrival and selects the smallest remaining burst, so a shorter job can preempt the running one.

Use:

  • turnaround time = completion time - arrival time

  • waiting time = turnaround time - burst time

Take A (arrival 0, burst 7), B (2, 4), C (4, 1) and D (5, 4). SRTF gives A 0-2, B 2-4, C 4-5, B 5-7, D 7-11, A 11-16. Completion times are A=16, B=7, C=5, D=11; turnaround times are 16, 5, 1, 6; waiting times are 9, 1, 0, 2. Average waiting is (9+1+0+2)/4 = 3. Five internal switches occur at 2, 4, 5, 7 and 11.

Non-preemptive SJF gives A 0-7, C 7-8, B 8-12, D 12-16; earlier arrival breaks the B/D tie. Waiting times are A=0, C=3, B=6, D=7, averaging (0+3+6+7)/4 = 16/4 = 4.

Gantt charts comparing SRTF and non-preemptive SJF for processes A to D, with average waiting times of 3 and 4 respectively.

Questions 1-2: identify SRTF and recognise preemption correctly

Question 1

The Shortest Remaining Time (SRT) is the preemptive version of which scheduling algorithm?

  • A. Round Robin (RR)

  • B. First Come First Serve (FCFS)

  • C. Priority

  • D. Shortest Job Next (SJN)

Answer: D. Shortest Job Next (SJN).

Shortest Job Next is non-preemptive SJF. SRT or SRTF is its preemptive counterpart because it compares remaining time when the ready set changes. Round Robin rotates by quantum, FCFS follows arrival order, and Priority uses assigned priority.

Question 2

Which of the following statements is/are true about preemptive type process scheduling in an operating system? (i) In preemptive scheduling, the utilisation of CPU is low.(ii) Shortest Job First process scheduling is an example of preemptive scheduling.

  • A. Only (i)

  • B. Only (ii)

  • C. Both (i) and (ii)

  • D. Neither (i) nor (ii)

Answer: D. Neither (i) nor (ii).

Statement (i) is false: switching adds overhead, but preemption does not inherently make utilisation low. Statement (ii) is false because standard SJF is non-preemptive; its preemptive form is SRTF. “Preemptive SJF” informally means SRTF.

Questions 3-5: minimum waiting time and why shortest-first wins

Question 3

Which of the following scheduling algorithm gives a minimum average waiting time?

  • A. FCFS

  • B. Priority

  • C. SJF

  • D. RR

Answer: C. SJF.

For ready jobs 3 and 8, order 8,3 gives waits 0,8, averaging 4; order 3,8 gives 0,3, averaging 1.5. Repeated shorter-first exchanges lower total waiting, explaining SJF. Real systems estimate future bursts.

Question 4

Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue? (GATE 2016, open the original question).

  • A. Shortest remaining time first

  • B. Round-robin with time quantum less than the shortest CPU burst

  • C. Uniform random

  • D. Highest priority first with priority proportional to CPU burst length

Answer: A. Shortest remaining time first.

All arrive together, so no arrival triggers preemption. SRTF becomes shortest-to-longest SJF, minimising average waiting. Round Robin targets responsiveness, random order offers no guarantee, and option D favours long bursts when higher values mean higher priority.

Question 5

Consider a set of n tasks with known runtimes r1, r2 .... rn to be run on a uniprocessor machine. Which of the following processor scheduling algorithms will result in the maximum throughput? (GATE 2001, open the original question).

  • A. Round-Robin

  • B. Shortest-Job-First

  • C. Highest-Response-Ratio-Next

  • D. First-Come-First-Served

Answer: B. Shortest-Job-First.

With runtimes 2, 5, 9, SJF completes at 2, 7, 16; reverse order completes at 9, 14, 16. By time 8, SJF has finished two jobs and reverse order none, maximising finite-batch throughput by intermediate deadlines. Ignoring overhead, every policy finishes all jobs.

Questions 6-8: starvation, mixed statements and equal bursts

Question 6

Among the following CPU scheduling algorithms, which is most likely to cause starvation for long-running processes?

  • A. Shortest Job First (SJF) - non-preemptive

  • B. Round Robin (RR)

  • C. First-Come, First-Served (FCFS)

  • D. Multilevel Feedback Queue

Answer: A. Shortest Job First (SJF) - non-preemptive.

L with burst 30 may wait indefinitely if a 1-unit job precedes each SJF decision. SRTF shares this risk. Round Robin gives recurring turns and FCFS preserves order. SJF is clearest, without assuming every multilevel feedback implementation is starvation-free.

Question 7

Consider the following statements:

S1: LRU page replacement algorithm suffers from Belady’s anomaly.

S2: Shortest Remaining Time First (SRTF) scheduling may cause starvation.

S3: The stack is shared by all threads in a process.

Which of the following is correct?

  • A. S1, S2 and S3 are true

  • B. S1 and S3 are false, and S2 is true

  • C. S1 and S2 are false, and S3 is true

  • D. S1, S2 and S3 are false

Answer: B. S1 and S3 are false, and S2 is true.

Statement

Truth

Reason

S1

False

LRU is a stack algorithm, so it has no Belady's anomaly.

S2

True

Arriving short jobs can indefinitely delay a long job.

S3

False

Threads share process resources, but each has its own stack and registers.

Question 8

Let's assume there are four process P1, P2, P3, P4 is a system having arrival time (0,1,2,3) respectively, all the processes have equal CPU burst time. Then which of the following is correct?

  • A. SRTF performs better than FCFS.

  • B. FCFS performs better than SRTF.

  • C. SRTF and FCFS behaves identical

  • D. None of these

Answer: C. SRTF and FCFS behaves identical.

Let each burst be 5. At time 1, P1 has 4 left versus P2's 5; at times 2 and 3 it has 3 and 2 left. No arrival preempts it. The same logic preserves P2, P3, P4 order, matching FCFS.

Questions 9-10: count SRTF switches and calculate SJF waiting time

Question 9

Consider three CPU-intensive processes, which require 10,20 and 30 time units and arrive at times 0,2 and 6, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end. (GATE 2006, open the original question).

  • A. 1

  • B. 2

  • C. 3

  • D. 4

Answer: B. 2.

P1 (0,10) has 8 left at time 2 and 4 left at time 6, so neither P2 (2,20) nor P3 (6,30) preempts it. Schedule: P1 0-10, P2 10-30, P3 30-60. Excluding initial and final dispatches, P1 to P2 and P2 to P3 give 2. Arrival alone is not a switch.

Question 10

Consider the following processes, all arriving at time 0, with their respective burst times:

Process

Burst Time (ms)

P1

6

P2

8

P3

7

P4

3

Using Non-Preemptive Shortest Job First (SJF) scheduling, calculate the average waiting time.

  • A. 7.0 ms

  • B. 6.25 ms

  • C. 5.0 ms

  • D. 6.0 ms

  • E. 5.5 ms

Answer: A. 7.0 ms.

Order: P4(3), P1(6), P3(7), P2(8). Schedule: P4 0-3, P1 3-9, P3 9-16, P2 16-24. Waits are 0, 3, 9, 16, so (0+3+9+16)/4 = 28/4 = 7.0 ms. Since arrivals are 0, completion minus burst confirms them.

Question 11: compare complete policies on staggered arrivals

Question 11

Consider the table below, which shows the arrival time and burst time (in ms) for five processes:

Process

Arrival time

Burst time

1

0

6

2

4

4

3

3

7

4

2

4

5

7

2

Which of the following scheduling policies gives the minimum average waiting time for these processes?

  • A. Round Robin with time quantum 6

  • B. SJF (Shortest Job First, non-preemptive)

  • C. FCFS

  • D. Both SJF and FCFS

Answer: B. SJF (Shortest Job First, non-preemptive).

Only P1 is ready at 0. SJF gives P1 0-6, P4 6-10, P5 10-12, P2 12-16, P3 16-23; P4 wins the burst-4 tie by earlier arrival. Waits are P1=0, P2=8, P3=13, P4=4, P5=3, averaging (0+8+13+4+3)/5 = 28/5 = 5.6 ms.

FCFS gives 7.6 ms and Round Robin with quantum 6 gives 8.4 ms, so only SJF is minimum. SRTF is not a choice and cannot be substituted.

Final revision grid and the next practice step

Rule

Remember

SJF

Smallest burst only when the CPU becomes free.

SRTF

Smallest remaining burst at arrivals and completions.

Starvation

Both can starve long jobs.

Switch

An arrival counts only if the running process changes.

Thirty-second check: list arrivals and bursts, mark decisions, compare ready processes, update remaining time, calculate CT-AT-BT, and apply switch exclusions.

Rebuild the rules with CPU Scheduling: FCFS, SJF, Round Robin and Priority. The earlier Process Scheduling MCQs: 12 Solved GATE Questions owns the broad GATE survey across FCFS, SJF, SRTF and Round Robin. Questions 4, 5 and 9 appear there as canonical PYQs; here they calibrate shortest-first reasoning alongside eight additional SJF/SRTF questions. Continue exam study with GATE Guidance by Sanchit Sir, or build broader foundations through the ZERO TO HERO Complete CS Course.