Question
A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to?
| Subnet Address | Subnet Mask (in CIDR notation) | Interface |
|---|---|---|
| 145.36.0.0 | /16 | E1 |
| 145.36.128.0 | /17 | E2 |
| 145.36.64.0 | /18 | E3 |
| 145.36.255.0 | /24 | E4 |
| Default | -- | E5 |
Official answer and solution
- Official answer
- A
- From
- Official GATE 2025 answer key
Solution
Convert the third octet of 145.36.109.70 () to binary and apply longest-prefix matching.
The destination IP address 145.36.109.70 has first two octets 145.36 and third octet . Checking each routing table entry:
145.36.0.0/16(E1): First 16 bits are145.36Matches (prefix length 16).145.36.128.0/17(E2): Third octet of subnet is ; 17th bit is1, whereas for the 17th bit is0Does not match.145.36.64.0/18(E3): Third octet of subnet is ; bits 17-18 are01, which matches bits 17-18 of Matches (prefix length 18).145.36.255.0/24(E4): Third octet Does not match.Default(E5): Matches with prefix length 0.
By the longest-prefix match rule, the /18 entry wins, forwarding the packet to interface E3.
Option (A)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 40 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.