Computer networks interview questionswith answers and explanations
23 original computer networks questions of the kind asked in technical MCQ rounds and interviews, each with the answer and a short explanation. To answer them yourself first, open the CS fundamentals practice.
- questions
- 23
- easy
- 13
- medium
- 7
- hard
- 3
Question 1
EasyWhich OSI layer is responsible for routing packets between different networks?
- AData link
- BNetworkAnswer
- CTransport
- DSession
Explanation
The network layer (IP) handles logical addressing and routing between networks.
Question 2
EasyWhich statement about TCP and UDP is true?
- ATCP guarantees in-order delivery; UDP does not.Answer
- BUDP retransmits lost packets.
- CTCP is connectionless.
- DUDP uses a three-way handshake.
Explanation
TCP is connection-oriented with sequencing and retransmission. UDP is connectionless and gives no delivery or ordering guarantees.
Question 3
MediumHow many usable host addresses does a /26 IPv4 subnet have?
- A64
- B62Answer
- C30
- D126
Explanation
A /26 leaves 6 host bits: 2⁶ = 64 addresses, minus the network and broadcast addresses = 62.
Question 4
EasyWhich protocol turns a domain name such as www.example.com into an IP address?
- ADHCP
- BARP
- CDNSAnswer
- DFTP
Explanation
DNS (Domain Name System) resolves names to IP addresses. DHCP hands out addresses, ARP finds MAC addresses, and FTP transfers files.
Question 5
EasyOn a local network, which protocol finds the MAC address for a known IPv4 address?
- ADNS
- BARPAnswer
- CICMP
- DNAT
Explanation
ARP (Address Resolution Protocol) broadcasts 'who has this IP?' and the owner replies with its MAC address.
Question 6
EasyWhat is the default port for HTTPS?
- A80
- B443Answer
- C22
- D8080
Explanation
HTTPS uses TCP port 443. Port 80 is plain HTTP, 22 is SSH, and 8080 is a common alternative HTTP port.
Question 7
EasyIn what order are the segments of a TCP three-way handshake sent?
- ASYN, ACK, FIN
- BSYN, SYN-ACK, ACKAnswer
- CACK, SYN, SYN-ACK
- DSYN, ACK, SYN-ACK
Explanation
The client sends SYN, the server answers SYN-ACK (acknowledging and sending its own SYN), and the client confirms with ACK.
Question 8
EasyWhich device works at the data link layer and forwards frames using MAC addresses?
- AHub
- BRouter
- CRepeater
- DSwitchAnswer
Explanation
A switch learns which MAC address is on which port and forwards each frame only there. Hubs and repeaters work at the physical layer, and routers at the network layer.
Question 9
MediumWhich of these IPv4 addresses is a private address?
- A172.32.0.1
- B11.0.0.1
- C172.20.5.1Answer
- D192.169.1.1
Explanation
The private ranges are 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. Only 172.20.5.1 falls in one of them.
Question 10
MediumWhat is the network address of the host 192.168.10.77/27?
- A192.168.10.32
- B192.168.10.77
- C192.168.10.96
- D192.168.10.64Answer
Explanation
A /27 leaves 5 host bits, so subnets come in blocks of 32: 0, 32, 64, 96 and so on. 77 falls in the block 64 to 95, so the network address is 192.168.10.64.
Question 11
MediumWhat is the broadcast address of the subnet containing 10.0.5.130/25?
- A10.0.5.255Answer
- B10.0.5.127
- C10.0.5.128
- D10.0.255.255
Explanation
A /25 splits the last octet into blocks of 128. 130 is in the block 128 to 255, whose last address, 10.0.5.255, is the broadcast address.
Question 12
MediumWhich subnet mask is the same as /20?
- A255.255.255.240
- B255.255.240.0Answer
- C255.255.248.0
- D255.240.0.0
Explanation
/20 means 20 one-bits: 8 + 8 + 4. The third octet is 11110000 = 240, so the mask is 255.255.240.0.
Question 13
MediumLive video calls usually carry their audio and video over UDP. Why?
- AUDP guarantees that every frame arrives
- BLate packets are useless, and UDP avoids the delay of retransmitting lost onesAnswer
- CUDP encrypts the media by default
- DUDP is the only protocol routers forward
Explanation
For live media, low delay matters more than perfect delivery. TCP would stall the stream to resend a lost packet; UDP lets the app skip it and carry on.
Question 14
EasyWhich OSI layer does HTTP belong to?
- AApplicationAnswer
- BTransport
- CSession
- DNetwork
Explanation
HTTP is an application-layer protocol. It runs over TCP (or QUIC), which handles the transport layer.
Question 15
EasyWhich statement about ICMP is true?
- AICMP runs on top of TCP
- BICMP assigns IP addresses to hosts
- Cping uses ICMP echo request and echo reply messagesAnswer
- DICMP encrypts IP packets
Explanation
ICMP carries control and error messages for IP, such as 'destination unreachable'. ping sends echo requests and waits for echo replies. ICMP sits directly on IP, not on TCP.
Question 16
EasyWhat is the main job of DHCP?
- ATurning domain names into IP addresses
- BRouting packets between networks
- CEncrypting web traffic
- DGiving hosts an IP address and network settings automaticallyAnswer
Explanation
A DHCP server leases each joining host an IP address along with the subnet mask, default gateway and DNS servers.
Question 17
MediumEight computers are connected to one switch, with no VLANs configured. How many collision domains and broadcast domains are there?
- A8 collision domains and 1 broadcast domainAnswer
- B1 collision domain and 1 broadcast domain
- C8 collision domains and 8 broadcast domains
- D1 collision domain and 8 broadcast domains
Explanation
Each switch port is its own collision domain, giving 8. A switch forwards broadcasts out of every port, so without VLANs or a router they all share 1 broadcast domain.
Question 18
HardWhich TCP mechanism stops a fast sender from overwhelming a slow receiver?
- AThe congestion window grown by slow start
- BThe TTL field in the IP header
- CThe receive window advertised by the receiverAnswer
- DThe checksum
Explanation
This is flow control: the receiver advertises how much buffer space it has left, and the sender keeps its unacknowledged data within it. The congestion window protects the network, not the receiver.
Question 19
HardHow long does it take to put a 1,500-byte frame onto a 100 Mbps link (the transmission delay)?
- A15 µs
- B12 µs
- C1.2 ms
- D120 µsAnswer
Explanation
1,500 bytes = 12,000 bits. At 100,000,000 bits per second that takes 12,000 / 100,000,000 = 0.00012 s = 120 µs.
Question 20
EasyWhich HTTP status code means the requested resource was not found?
- A401
- B500
- C301
- D404Answer
Explanation
404 is Not Found. 401 means authentication is needed, 500 is a server error, and 301 is a permanent redirect.
Question 21
HardA /24 network is split into /28 subnets. How many subnets are there, and how many usable host addresses does each have?
- A16 subnets, 14 usable hosts eachAnswer
- B16 subnets, 16 usable hosts each
- C14 subnets, 16 usable hosts each
- D8 subnets, 30 usable hosts each
Explanation
Going from /24 to /28 borrows 4 bits: 2⁴ = 16 subnets. Each keeps 4 host bits: 2⁴ = 16 addresses, minus the network and broadcast addresses, leaves 14 usable.
Question 22
EasyWhat does NAT on a home router do?
- ATranslates the private addresses of home devices to the router's public address, so they can share itAnswer
- BAssigns MAC addresses to devices
- CTurns domain names into IP addresses
- DEncrypts all outgoing traffic
Explanation
NAT rewrites the source address (and usually the port) of outgoing packets to the public address, and keeps a table to send replies back to the right private device.
Question 23
EasyHow long is an IPv6 address?
- A64 bits
- B32 bits
- C128 bitsAnswer
- D48 bits
Explanation
IPv6 addresses are 128 bits, written as eight groups of four hex digits. IPv4 uses 32 bits and a MAC address 48.