Step 1: Think of a house:
A house has one main door. Everyone coming in or going out uses it.
In a network, the gateway is that main door.
Step 2: Test each device against the door idea:
Modem: it changes signal types. Data does not have to pass a modem to leave a network that has other paths.
Switch: it joins devices inside the same LAN, so it is an inside corridor and not a door.
Repeater: it only makes a weak signal strong again.
Gateway: all data to or from other networks must pass through it, and it can also translate protocols.
Step 3: Choose:
Only the gateway matches the sentence in the question.
Final Answer:
The answer is Gateway, option (B).