Processes, Threads & System Calls

Answer & solution
Official answer: 21
Approach: Count the state transitions into Ready rather than all context switches.
The scanf causes one I/O request. The loop has exactly twenty iterations, so its printf causes twenty more requests. There are 21 I/O operations in all. Each request takes the process from Running to Blocked (the I/O queue); that transition does not enter the ready queue.
When each I/O operation completes, the blocked process becomes eligible to run again and enters Ready once. Thus 21 completions produce 21 ready-queue entries. The initially admitted Ready entry is explicitly excluded, giving the answer 21 rather than 22.
There can be two stipulated context-switch events around an I/O episode, but they must not both be counted as Ready entries. The intended model assumes no additional time-slice or priority preemptions; such unspecified events could add entries. It also treats library I/O as blocking regardless of real-world stdio buffering.