GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 36

GATE CSE 2015 Set 2 Q36

Computer Networks · Routing Algorithms · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q36 2 marks · MCQ
Report issue

Routing Algorithms

Question 36, GATE 2015: Routing entries:128.96.170.0/23→interface 0; 128.96.168.0/23→interface 1; 128.96.166.0/23→R2; 128.96.164.0/22→R3; default→R4. Destinations i128.96.171.92, ii 128.96.167.151, iii 128.96.163.151, iv 128.96.165.121. Labels ainterface 0, binterface 1, cR2, dR3, eR4. A i-a, ii-c, iii-e, iv-d; B i-a, ii-d, iii-b, iv-e; C i-b, ii-c, iii-d, iv-e; D i-b, ii-c, iii-e, iv-d.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (6 steps)

Longest-prefix matching sends 171.92 through 170.0/23 to interface 0; 167.151 matches 166.0/23 and 164.0/22, choosing the longer/23 to R2; 163.151 matches only default R4; 165.121 matches 164.0/22 to R3. Thus i-a, ii-c, iii-e, iv-d, A.

A /23 mask covers two adjacent third-octet values, so 170.0/23 covers 170–171 and 166.0/23 covers 166–167. A /22 mask starting 164 covers 164–167. Thus 171 uses interface 0; 167 matches both R2 and R3 but the longer/23 wins; 163 matches neither specific block and uses default R4; 165 matches only 164/22 and uses R3. Never stop at the first matching broad prefix without checking whether a more specific one exists.

Original paper, page 38 · Answer key