GATE 2023 CS – Question 65
The forwarding table of a router is shown below.
Subnet Number / Subnet Mask / Interface ID:
200.150.0.0 / 255.255.0.0 / 1
200.150.64.0 / 255.255.224.0 / 2
200.150.68.0 / 255.255.255.0 / 3
200.150.68.64 / 255.255.255.224 / 4
Default / - / 0
A packet addressed to a destination address 200.150.68.118 arrives at the router. It will be forwarded to the interface with ID ______.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 3
Explanation
The destination address is $200.150.68.118$. Check each entry:
| Entry | Range covered | Matches? |
|---|---|---|
| 200.150.0.0 / 255.255.0.0 (/16) | 200.150.0.0 – 200.150.255.255 | yes |
| 200.150.64.0 / 255.255.224.0 (/19) | third octet 64–95 | yes (68 is in range) |
| 200.150.68.0 / 255.255.255.0 (/24) | 200.150.68.0 – .255 | yes |
| 200.150.68.64 / 255.255.255.224 (/27) | 200.150.68.64 – .95 | no (118 > 95) |
The /16, /19 and /24 entries match. The routing rule is **longest prefix match**, so the /24 entry wins: interface **3**.
More IPv4: Addressing, CIDR, Fragmentation and NAT questions
- GATE 2022 CS Q22
- GATE 2022 CS Q55
- GATE 2021 CS (CS1) Q55
- GATE 2020 CS Q25
- GATE 2020 CS Q48
- GATE 2019 CS Q38
All IPv4: Addressing, CIDR, Fragmentation and NAT questions →