As we know that when data packets arrived at the internal router, it will perform the following steps:
- Find the first address/subnet id between the destination IP address and subnet mask using bitwise and operation.
- after finding the first address 3 cases can be there:
- If FA is matched with one subnet address then data is forwarded to the matched subnet address.
- If FA is matched with more than one subnet address then data is forwarded to the interface corresponding to the largest subnet mask (maximum number of 1’s)
- If FA is not matched with anyone then the data packet is forwarded to the default interface.
let’s check one by one:
(A): $200.150.68.118 \wedge 255.255.0.0$
$\begin{array}{rrrr} 200.150.68.118= 200 & 150& 01000100&01110110 \\\ \wedge 255.255.0.0 =255&255&00000000&00000000 \\ \hline 200.150.0.0=200&150&00000000&00000000 \end{array}$
$\therefore $ subnet id=$200.150.0.0$,matched
(B): $200.150.68.118 \wedge 255.255.224.0$
$\begin{array}{rrrr} 200.150.68.118= 200 & 150& 01000100&01110110 \\\ \wedge 255.255.224.0=255&255&11100000&00000000 \\ \hline 200.150.64.0=200&150&01000000&00000000 \end{array}$
$\therefore $ subnet id=$200.150.64.0$,matched.
(C): $200.150.68.118 \wedge 255.255.255.0$
$\begin{array}{rrrr} 200.150.68.118= 200 & 150& 01000100&01110110 \\\ \wedge 255.255.255.0=255&255&11111111&00000000 \\ \hline 200.150.68.0=200&150&01000100&00000000 \end{array}$
$\therefore $ subnet id=$200.150.68.0$,matched.
(D): $200.150.68.118 \wedge 255.255.255.224$
$\begin{array}{rrrr} 200.150.68.118= 200 & 150& 01000100&01110110 \\\ \wedge 255.255.255.224=255&255&11111111&11100000 \\ \hline 200.150.68.96=200&150&01000100&01100000 \end{array}$
$\therefore $ subnet id=$200.150.68.96$ not matched.
Since more than one subnet address is matched the data packet is forwarded to the interface corresponding to the largest subnet mask (a subnet mask having the maximum number of 1’s).
Here $255.255.255.0$ has the maximum number of 1’s in binary representation among A, B, and C so the data packet is forwarded to the interface id $3$.
the correct answer is $3$
Ref: A similar type of concept asked in the gate exam :
- GATE CSE 2003
- GATE CSE 2004
- GATE IT 2006
- GATE CSE 2014
- GATE CSE 2015