The process chart looks flow looks like:
(0 to 2s) -→ Running process: P1; Job remaining: 5s (gets preempted by incoming process P2 since execution time of P2 is lesser than the remaining time of P1)
(2 to 4s) -→ Running process: P2; Job remaining: 2s (gets preempted by incoming process P3 since P3 has least execution time among P1, P2 and P3 having remaining executions times equal to 5, 2 and 1 respectively)
(4 to 5s) -→ Running process: P3 (completes execution. Processes available in queue are P1, P2 and P4 having remaining time equal to 5, 2 and 4s. Process P2 gets picked.)
(5 to 7s) --→ Running process: P2 (completes execution. Processes available in queue are P1 and P4 having remaining time equal to 5 and 4s. Process P4 gets picked.)
(7 to 11s) --→ Running process: P4 (completes execution. Processes available in queue is P1 and gets picked.)
( 11 to 16s) --→ Running process: P4 (completes execution)
Waiting time = (Finish time – Arrival time) – Process duration
Wait time (P1) = (16 – 0) – 7 = 9
Wait time (P2) = (7 – 2) – 4 = 1
Wait time (P2) = (5 – 4) – 1 = 0
Wait time (P4) = (11 – 5) – 4 = 2
Average wait time = (9 + 1+ 0 + 2) / 4 = 12 / 4 = 3
Hence, answer: (B)