Q1. What is the size of an IPv4 address?
- A.64 bits
- B.128 bits
- C.16 bits
- D.32 bits✓ Correct
Explanation
An IPv4 address is 32 bits (4 bytes) long, typically written in dotted decimal notation (e.g., 192.168.1.1).
Topic in Computer Networks & Cloud Computing
The network layer moves packets from source host to destination host across multiple networks, handling logical IP addressing, routing and forwarding. Typical questions ask about 32-bit IPv4 and 128-bit IPv6 addresses, address classes and private ranges, subnet masks, CIDR notation and calculating usable hosts in a subnet. Routing items contrast static and dynamic routes, distance-vector protocols like RIP with link-state protocols like OSPF, and the role of BGP between autonomous systems. Also be ready for IP fragmentation and the TTL field, broadcast versus multicast addresses, NAT, ICMP, and how a router chooses the next hop using longest-prefix matching.
Below are 30 practice questions from a pool of 210 Network Layer MCQs, one of 10 topics in Computer Networks & Cloud Computing. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.
Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Q1. What is the size of an IPv4 address?
An IPv4 address is 32 bits (4 bytes) long, typically written in dotted decimal notation (e.g., 192.168.1.1).
Q2. What is the main function of a router?
A router's main function is to forward packets from one network to another by examining the destination IP address and consulting its routing table.
Q3. Which class of IPv4 addresses is used for multicasting?
Class D addresses (224.0.0.0 to 239.255.255.255) are reserved for multicast groups.
Q4. What does the TTL field in an IP header stand for?
TTL (Time to Live) limits the lifespan of a packet. Each router decrements it by 1, and when it reaches 0, the packet is discarded to prevent infinite loops.
Q5. Which protocol is used to send error messages at the network layer?
ICMP (Internet Control Message Protocol) is used to send error messages and operational information, such as destination unreachable or time exceeded.
Q6. What is the default subnet mask for a Class C IPv4 address?
Class C addresses have a default subnet mask of 255.255.255.0, meaning the first 24 bits identify the network and the last 8 bits identify the host.
Q7. Which IP address range is reserved for loopback testing?
The address range 127.0.0.0/8 is reserved for loopback. The most commonly used loopback address is 127.0.0.1.
Q8. What tool uses ICMP echo requests to test connectivity?
The ping command uses ICMP echo request and echo reply messages to test whether a remote host is reachable.
Q9. Which of the following is a private IPv4 address?
192.168.1.1 is a private IP address. Private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.
Q10. What is the purpose of NAT (Network Address Translation)?
NAT translates private (internal) IP addresses to public (external) IP addresses, allowing multiple devices to share a single public IP address.
Q11. In CIDR notation, what does /28 mean?
In CIDR notation, /28 means the first 28 bits of the address are used for the network portion, leaving 4 bits for host addresses (14 usable hosts).
Q12. How many usable host addresses are available in a /26 subnet?
A /26 subnet has 6 host bits: 2^6 = 64 total addresses. Subtracting the network address and broadcast address gives 62 usable host addresses.
Q13. Which routing protocol uses the Bellman-Ford algorithm?
RIP (Routing Information Protocol) uses the Bellman-Ford (distance vector) algorithm to determine the best path based on hop count.
Q14. What is the maximum hop count in RIP?
RIP uses a maximum hop count of 15. A hop count of 16 means the destination is unreachable, limiting RIP to small networks.
Q15. OSPF is classified as which type of routing protocol?
OSPF (Open Shortest Path First) is a link-state routing protocol that uses Dijkstra's algorithm to compute the shortest path.
Q16. What is the size of an IPv6 address?
An IPv6 address is 128 bits (16 bytes) long, written as eight groups of four hexadecimal digits separated by colons.
Q17. What is the count-to-infinity problem associated with?
The count-to-infinity problem occurs in distance vector routing protocols where routers slowly increment the distance to an unreachable network, causing slow convergence.
Q18. Which field in the IPv4 header is used for fragmentation reassembly?
The Identification field, along with Flags and Fragment Offset, is used to identify fragments belonging to the same original datagram for reassembly.
Q19. What does DHCP provide?
DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses, subnet masks, default gateways, and other network configuration to devices.
Q20. Which protocol is used between autonomous systems on the Internet?
BGP (Border Gateway Protocol) is the standard exterior gateway protocol used to exchange routing information between autonomous systems on the Internet.
Q21. Given the IP address 172.16.45.14/21, what is the network address?
With /21, the mask is 255.255.248.0. The third octet 45 in binary is 00101101. ANDing with 11111000 gives 00101000 = 40. So the network is 172.16.40.0.
Q22. In OSPF, what is an Area Border Router (ABR)?
An ABR connects two or more OSPF areas, including the backbone area (Area 0). It maintains separate link-state databases for each area.
Q23. What technique does split horizon use to solve the count-to-infinity problem?
Split horizon prevents a router from advertising a route back through the interface from which the route was originally learned, helping to prevent routing loops.
Q24. In IPv6, what replaces broadcast?
IPv6 eliminates broadcast addressing. Its functionality is replaced by multicast (to multiple specific hosts) and anycast (to the nearest host in a group).
Q25. What is the purpose of the OSPF Designated Router (DR)?
The DR reduces adjacencies on multi-access networks. Instead of every router forming adjacencies with every other router, all routers form adjacencies only with the DR and BDR.
Q26. A company needs to create 6 subnets from a /24 network. What is the most efficient subnet mask to use?
To create 6 subnets, we need at least 3 borrowed bits (2^3 = 8 subnets >= 6). Starting from /24, borrowing 3 bits gives /27 with 30 usable hosts per subnet.
Q27. What is the function of the Protocol field in the IPv4 header?
The Protocol field identifies the upper-layer protocol encapsulated in the IP datagram. TCP is 6, UDP is 17, ICMP is 1, and OSPF is 89.
Q28. In BGP, what is the AS_PATH attribute used for?
AS_PATH lists all autonomous systems a route advertisement has traversed. It is used for loop prevention (a router rejects routes containing its own AS number) and path selection.
Q29. What is the main advantage of VLSM (Variable Length Subnet Masking)?
VLSM allows different subnets to have different sizes (subnet masks), enabling more efficient use of IP address space by matching subnet size to actual needs.
Q30. What is route aggregation (supernetting) and why is it important?
Route aggregation (supernetting) combines contiguous network prefixes into a single summary route, reducing the size of routing tables and improving router efficiency.
Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.
Start Network Layer Quiz