Application Layer MCQs for NSCT
The application layer holds the protocols that applications use to talk across a network: HTTP for the web, DNS for names, SMTP for sending email, FTP for files and DHCP for automatic addressing. It is topic 6 of the Computer Networks and Cloud Computing area, which carries 10% of the NSCT according to HEC's Areas of Competencies. Networks averaged 39.6% accuracy in 2026, per the HEC NSCT report and APP.
Each protocol runs over the transport layer, so many questions ask which one uses TCP or UDP and on which port.
| Protocol | Transport | Default port(s) |
|---|---|---|
| HTTP / HTTPS | TCP (HTTP/3: UDP via QUIC) | 80 / 443 |
| DNS | UDP, TCP for large replies and zone transfers | 53 |
| SMTP | TCP | 25 (587 for client submission) |
| POP3 / IMAP | TCP | 110 / 143 |
| FTP | TCP | 21 control, 20 data (active mode) |
| DHCP | UDP | 67 server, 68 client |
HTTP
HTTP (HyperText Transfer Protocol) is a stateless request-response protocol: the server does not remember earlier requests, and cookies add state on top. A request names a method (GET, POST, PUT, DELETE) and a URL; the response carries a status code.
| Code | Meaning |
|---|---|
| 200 | OK |
| 301 / 302 | Moved permanently / temporarily |
| 304 | Not Modified (cached copy still valid) |
| 403 / 404 | Forbidden / Not Found |
| 500 | Internal Server Error |
Non-persistent HTTP opens a new TCP connection per object (2 RTTs each). Persistent HTTP reuses one connection, and HTTP/2 multiplexes many streams over it. Exam angle: a page with a base file and 8 images takes 18 RTTs non-persistent, 10 RTTs persistent without pipelining, and about 3 RTTs with pipelining.
DNS
DNS (Domain Name System) is a distributed, hierarchical database that maps names to addresses. Root servers point to TLD servers (.pk, .com), which point to the domain's authoritative servers. Your host usually sends a recursive query to a local resolver, which then queries the hierarchy iteratively and caches each answer for its TTL.
Common record types: A (IPv4 address), AAAA (IPv6), CNAME (alias), MX (mail server), NS (name server) and PTR (reverse lookup). Exam angle: a host that can ping an IP address but not a name has a DNS problem, not a routing one.
SMTP
SMTP (Simple Mail Transfer Protocol) pushes mail from a sender's client to its mail server and from server to server. Retrieval uses different protocols: POP3 downloads to one device, while IMAP keeps mail and folders on the server.
Example: Bob sends from webmail in his browser to Sara, who reads on her phone. The path is HTTP (browser to Bob's server), SMTP (Bob's server to Sara's server), then IMAP (Sara's server to her phone). Exam angle: SMTP is push; POP3 and IMAP are pull.
FTP
FTP (File Transfer Protocol) uses two TCP connections. The control connection on port 21 stays open for commands such as USER, RETR (download) and STOR (upload); a separate data connection opens for each file. Because commands travel on their own connection, FTP is said to send control information "out of band". It is also stateful, since the server tracks the user's current directory.
In active mode the server connects back to the client from port 20; in passive mode (PASV) the client opens the data connection, which works through NAT. Exam angle: FTP is stateful and out of band; HTTP is stateless and in band.
DHCP
DHCP (Dynamic Host Configuration Protocol) leases an IP address, subnet mask, default gateway and DNS server to a host. It follows four steps, known as DORA: Discover (broadcast from 0.0.0.0 to 255.255.255.255), Offer, Request and Acknowledge. It runs over UDP because the client has no address yet. Exam angle: an address in 169.254.0.0/16 means no DHCP server answered.
Common traps
- Calling SMTP a retrieval protocol; it only sends and relays mail.
- Assuming DNS uses only UDP. Zone transfers and large replies use TCP.
- Mixing up 301 (permanent) with 302 (temporary), or 401 with 403.
- Forgetting the TCP handshake RTT when counting HTTP response times.
- Believing cookies make HTTP itself stateful.
- Swapping FTP's ports: 21 is control and 20 is active-mode data.
Worked examples
Understanding. Which protocol converts www.hec.gov.pk into an IP address? Answer: DNS. The resolver follows root, .pk TLD and authoritative servers, or answers from its cache.
Application. A page has a base HTML file and 5 images. With non-persistent HTTP and up to 5 parallel connections, and an RTT of 30 ms, how long does it take, ignoring transmission time? Answer: 120 ms. The base file needs 2 RTTs (handshake plus request). All 5 images then load in parallel in 2 more RTTs: 4 × 30 = 120 ms.
Analysis. After joining a new Wi-Fi network, a laptop gets 192.168.0.23, can open http://142.250.181.14 by address, but cannot resolve any names. Other laptops are fine. What is wrong? Answer: the DNS setting. Addressing, the gateway and routing work, because traffic by IP succeeds. The laptop is probably using a manually set or unreachable DNS server instead of the one DHCP offered.
Practise
The quiz below has 100 Application Layer questions, which you can filter by tier and difficulty.
Practise: 100 questions
FAQs
Which application-layer protocols use UDP?
DNS (for normal queries), DHCP, TFTP, SNMP and many real-time media protocols use UDP. HTTP/3 also uses UDP, through QUIC. HTTP/1.1, HTTP/2, SMTP, POP3, IMAP, FTP, SSH and Telnet use TCP because they need reliable, ordered delivery.
What is the difference between a recursive and an iterative DNS query?
In a recursive query, the server must return the final answer or an error, doing any further lookups itself. In an iterative query, the server replies with the best it knows, often a referral to another server, and the asker continues. Hosts usually query their resolver recursively; resolvers query the hierarchy iteratively.
Is HTTPS a separate protocol from HTTP?
HTTPS is HTTP sent over TLS (Transport Layer Security), normally on port 443. The HTTP messages are the same; TLS encrypts them and authenticates the server with a certificate. Security details are covered in the network security topic.
How is this different from the Web Development area?
Here the focus is on how protocols work: ports, transport choices, message flow and timing. The Web Development MCQs focus on building web applications, such as HTML, CSS, JavaScript, REST APIs and server-side frameworks. HTTP status codes and methods appear in both.
Next step
Continue with Wireless Networks MCQs, go back to the Networks & Cloud hub, or test every area in an NSCT mock test.