Question

Consider that 15 machines need to be connected in a LAN using 8-port Ethernet switches. Assume that these switches do not have any separate uplink ports. The minimum number of switches needed is ________.

Official answer and solution
Official answer
3
From
Official GATE 2019 answer key

Solution

Formulate the port budget equation for connecting kk switches into a single connected network and solve for the minimum kk to accommodate 15 hosts.

We are given:

  • Number of machines to connect: 15
  • Each switch has 8 ports and no separate uplink ports.

To connect kk switches together into a single loop-free broadcast domain (a connected tree topology), exactly k−1k - 1 inter-switch links are required.

Each inter-switch link connects two switch ports (one port on each connected switch). Therefore, k−1k - 1 links consume 2(k−1)2(k - 1) switch ports in total.

The total number of ports available for connecting end machines across all kk switches is:

Pavailable=8k−2(k−1)=6k+2P_{\text{available}} = 8k - 2(k - 1) = 6k + 2

We require Pavailable≥15P_{\text{available}} \ge 15:

6k+2≥15  ⟹  6k≥13  ⟹  k≥136≈2.176k + 2 \ge 15 \implies 6k \ge 13 \implies k \ge \frac{13}{6} \approx 2.17

Since kk must be an integer:

  • For k=1k = 1: available ports = 8(1)−0=8<158(1) - 0 = 8 < 15.
  • For k=2k = 2: available ports = 6(2)+2=14<156(2) + 2 = 14 < 15.
  • For k=3k = 3: available ports = 6(3)+2=20≥156(3) + 2 = 20 \ge 15.

Thus, the minimum number of switches needed is 3.

Final answer

3

Common trap

Assuming 2 switches provide 2×8=162 \times 8 = 16 ports, forgetting that connecting the 2 switches to each other consumes 1 port on each switch, leaving only 16−2=1416 - 2 = 14 ports for hosts.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2019 Computer Science and Information Technology (CS)
Question
59 of 65, printed as CS Q.49
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.