GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER NETWORKS

Compute usable hosts from IPv4 host bits

4 questions solved the same way, newest first. Back to Computer Networks

How these are solved

Count subnet/host bits from mask or required partitions and use 2^h-2 usable host addresses. Historical subnet-number exclusions in 2007 remain explicitly stated; this is a method family, not an interchangeable formula for every subnet convention.

1 mark · NAT
Report issue

Usable addresses in a slash-20 subnet

IP Addressing, Fragmentation & Address Resolution

Question 33, GATE 2026: An IPv4 subnet has mask 255.255.240.0. Find the maximum number of conventional network-interface addresses assignable in that subnet.
Tap to enlarge
Answer & solution

Official answer: 4094

Step through it (3 steps)

Givens and goal

An IPv4 subnet has mask 255.255.240.0. Find the maximum number of conventional network-interface addresses assignable in that subnet.

Approach

Count host bits and remove the two reserved endpoint addresses.

Step-by-step solution

1. The mask in binary is 11111111.11111111.11110000.00000000. It contains 8+8+4=20 leading ones, so the prefix length is /20.
2. An IPv4 address has 32 bits. The host portion therefore has 32−20=12 bits and permits 2¹²=4096 different bit patterns.
3. The all-zero host field denotes the subnet itself, while the all-one host field is the subnet-directed broadcast address. Neither is assigned to a conventional interface in this subnet.
4. Thus the usable count is 4096−2=4094. The special treatment of /31 point-to-point links is irrelevant to a /20 subnet. Reserving addresses administratively would reduce a particular deployment’s capacity, but no such reservation is specified.

Original paper, page 23 · Answer key

2 marks · MCQ
Report issue

Usable hosts under a /21 IPv4 mask

IP Addressing, Fragmentation & Address Resolution

Question 57, GATE 2008: A Class B network uses subnet mask 255.255.248.0. What is the maximum number of hosts per subnet?

(A) 1022
(B) 1023
(C) 2046
(D) 2047
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

Step through it (3 steps)

Step 1: 255.255.248.0 has 8+8+5=21 leading one bits because 248=11111000₂. Thus 32−21=11 host bits remain.
Step 2: A subnet has 211=2048 addresses; reserving the all-zero host part for the subnet address and the all-one host part for broadcast leaves 2046 usable host addresses, option C. The original Class B label does not change the host count once the subnet mask is supplied.

Original paper, page 11

2 marks · MCQ
Report issue

Class B subnet and host counts

IP Addressing, Fragmentation & Address Resolution

Question 67, GATE 2007: A class B address is divided into subnets using a 6-bit subnet number. What maximum numbers of subnets and hosts per subnet are intended?
Options:
(A) 62 subnets,262142 hosts
(B) 64 subnets,262142 hosts
(C) 62 subnets,1022 hosts
(D) 64 subnets,1024 hosts
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Approach. A class B prefix originally leaves 16 bits. Assigning six of those to subnet IDs leaves ten for hosts. Distinguish historical reserved subnet IDs from reserved host IDs and modern subnet conventions.

2. Derivation and interpretation. A class B network leaves 16 bits after its network prefix. Borrowing 6 subnet bits leaves 10 host bits, so usable ordinary unicast hosts per subnet are 210-2=1022. Under the historical convention excluding all-zero and all-one subnet numbers, the subnet count is 26-2=62, giving C. Modern subnetting permits those two subnet numbers and gives 64 subnets with 1022 hosts each; that pair is absent from the options. C is conditional on the obsolete convention, not a modern universal maximum.

Original paper, page 16

1 mark · MCQ
Report issue

Sixty-four subnets of a class B network

IP Addressing, Fragmentation & Address Resolution

Question 27, GATE 2005: A class-B network needs 64 departmental subnets. Mask? A255.255.0.0; B255.255.64.0; C255.255.128.0; D255.255.252.0.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step through it (3 steps)

Starting with a /16 class-B network, borrow 6 bits to obtain 26=64 subnets. The /22 mask is 255.255.252.0, D. This uses all subnet numbers; the obsolete convention excluding all-zero/all-one subnets would require a different count and is not applied.

A class-B prefix starts with 16 network bits. Six additional subnet bits give 64 patterns, leaving 10 host bits. The resulting prefix length 22 has mask 11111111.11111111.11111100.00000000, or 255.255.252.0. This uses all 64 subnet numbers under the modern convention, rather than subtracting two obsolete reserved subnet patterns.

Original paper, page 3