Skip to lesson

Practice: networks rapid-fire and subnetting drill

Networking rounds reward speed and precision: short exact answers, quick subnetting and one well-structured long answer. Each drill below is timed, so you walk in knowing which of your answers are ready and which need one more revision.

Round 1: 20 rapid-fire questions (6 minutes)

A rapid-fire round is a set of one-line questions asked quickly, often at the start of a technical interview. The goal is a crisp, correct answer in under 15 seconds, not an essay.

Cover the answers, write yours on paper, then compare. Count one mark per fully correct answer.

Example 1 · Rapid-fire set: 20 questions

Text
1. Layer of a switch?            11. DNS port and protocol?2. Layer of a router?            12. HTTPS port?3. PDU at the transport layer?   13. SSH port?4. Bits in IPv4 / IPv6?          14. MySQL port?5. Private range starting 172?   15. 401 vs 403?6. Usable hosts in a /24?        16. DHCP steps?7. TCP handshake?                17. What does ARP find?8. UDP header size?              18. Record for IPv6?9. Mask for /26?                 19. Which proxy sits before servers?10. Loopback IPv4 address?       20. Attack using a botnet?
Answers
1. Layer 2 (data link)            11. 53, UDP (TCP for large answers)
2. Layer 3 (network)              12. 443
3. Segment (TCP) / datagram (UDP) 13. 22
4. 32 / 128                       14. 3306
5. 172.16.0.0 to 172.31.255.255   15. 401 not authenticated, 403 not allowed
6. 254                            16. Discover, Offer, Request, Acknowledge
7. SYN, SYN-ACK, ACK              17. The MAC address for an IP on the LAN
8. 8 bytes                        18. AAAA
9. 255.255.255.192                19. Reverse proxy
10. 127.0.0.1                     20. DDoS

What this code does

  • Each answer is one short fact. That is the right length for a rapid-fire round; add a reason only if the interviewer asks "why?".
  • Questions 5, 7, 15 and 16 are the ones students most often get half right. If you missed any, reread the lesson that covers it.

How to answer:

  • Answer with the fact first: "Layer 3, router." Add one clause of reason only if asked.
  • If you do not know, say "I am not sure, my guess is..." and move on; do not freeze.
  • Weak on a topic? Go back to that lesson of this module and redo its MCQs.

Round 2: subnetting numericals (10 minutes)

A subnetting numerical gives an address with a prefix and asks for the mask, network, broadcast, host range or host count. Use the block-size method: block = 256 minus the mask octet, find the block that holds the address, then read off the rest.

Work the five questions by hand first. Then run the checker program to verify your answers; it uses the same bit operations a router uses.

Text
Q1 192.168.1.130/25   Q2 10.0.0.77/28   Q3 172.16.50.10/21Q4 Hosts in a /23?    Q5 Prefix for 6 subnets of a /24 with 30 hosts each?Answers:Q1 network .128, broadcast .255, hosts .129-.254 (126)Q2 network 10.0.0.64, broadcast 10.0.0.79, hosts .65-.78 (14)Q3 mask 255.255.248.0, network 172.16.48.0, broadcast 172.16.55.255 (2046 hosts)Q4 2^9 - 2 = 510Q5 /27 (8 subnets, 30 hosts each)

Example 2 · Subnetting answer checker

SubnetCheckDemo.javaJava
public class SubnetCheckDemo {    static int parse(String ip) {        int v = 0;        for (String p : ip.split("\\.")) v = (v << 8) | Integer.parseInt(p);        return v;    }
    static String dotted(int v) {        return (v >>> 24) + "." + ((v >>> 16) & 255) + "." + ((v >>> 8) & 255) + "." + (v & 255);    }
    static void solve(String label, String cidr) {        String[] p = cidr.split("/");        int prefix = Integer.parseInt(p[1]);        int mask = -1 << (32 - prefix);        int network = parse(p[0]) & mask;        int broadcast = network | ~mask;        long hosts = (1L << (32 - prefix)) - 2;        System.out.println(label + " " + cidr + ": mask " + dotted(mask) + ", network " + dotted(network)                + ", broadcast " + dotted(broadcast) + ", hosts " + hosts);    }
    public static void main(String[] args) {        solve("Q1", "192.168.1.130/25");        solve("Q2", "10.0.0.77/28");        solve("Q3", "172.16.50.10/21");        System.out.println("Q4 /23 hosts: " + ((1L << 9) - 2));        int bits = 0;        while ((1 << bits) < 6) bits++;        int prefix = 24 + bits;        System.out.println("Q5 6 subnets -> borrow " + bits + " bits -> /" + prefix                + " with " + ((1 << (32 - prefix)) - 2) + " hosts each");    }}
Output
Q1 192.168.1.130/25: mask 255.255.255.128, network 192.168.1.128, broadcast 192.168.1.255, hosts 126
Q2 10.0.0.77/28: mask 255.255.255.240, network 10.0.0.64, broadcast 10.0.0.79, hosts 14
Q3 172.16.50.10/21: mask 255.255.248.0, network 172.16.48.0, broadcast 172.16.55.255, hosts 2046
Q4 /23 hosts: 510
Q5 6 subnets -> borrow 3 bits -> /27 with 30 hosts each

What this code does

  • The program prints the same numbers as the hand answers in Round 2, so you can test any extra question you make up by adding a solve line.
  • Q5 checks both conditions: 3 borrowed bits give 8 ≥ 6 subnets, and a /27 still has 30 hosts, exactly what was needed.

Predict the output

Predict the subnet checks

Pick what each snippet prints.

Round 1 of 3

int a = (10 << 24) | (1 << 16) | (1 << 8) | 10;
int b = (10 << 24) | (1 << 16) | (2 << 8) | 10;
int mask = -1 << (32 - 24);
System.out.println((a & mask) == (b & mask));

Round 3: the URL journey in two minutes

The two-minute URL answer is a structured spoken answer with eight beats: parse, cache, DNS, TCP, TLS, HTTP request, server and render. End with an offer to go deeper into any step.

Say it aloud with a timer: under 90 seconds is too thin, over 150 seconds loses the interviewer.

Example 3 · A two-minute URL journey answer

Text
Question: "What happens when you type https://www.flipkart.com and press Enter?"Beats to cover: parse, cache, DNS, TCP, TLS, request, server, render.
Model answer (about 110 seconds aloud)
"First the browser parses the URL: scheme https, host www.flipkart.com, port 443.
It checks its own cache and the OS cache for the IP. If it is not there, the OS asks
the DNS resolver, which goes to a root server, the .com TLD server and Flipkart's
authoritative server, gets the A record and caches it for its TTL.
The browser then opens a TCP connection to that IP on port 443 with the three-way
handshake, and runs the TLS handshake: the server sends its certificate, the browser
checks the name, dates and CA, and both agree on session keys.
Now it sends an encrypted GET request with headers such as Host and cookies.
On the server side a load balancer passes it to an app server, which may read from a
cache or database and returns 200 OK with HTML.
The browser parses the HTML, fetches CSS, JavaScript and images, often over the same
HTTP/2 connection, builds the DOM and CSSOM, lays out and paints the page.
I can go deeper into DNS, TLS or rendering if you like."

What this code does

  • All eight beats appear in order, each in one or two sentences, with the concrete names interviewers listen for: root, TLD, authoritative, port 443, certificate, 200 OK, DOM.
  • The closing line hands control back to the interviewer, who will usually pick one beat to explore. That is where the follow-ups from the DNS lesson come in.

Close with an offer: "I can go deeper into any step."

Order of execution

Order the eight beats

Put the beats of the two-minute answer in order. The first beat covers the URL and the caches.

Record yourself on your phone once. Most people discover they skip TLS or say "the server sends the website" without the status code and HTML.

Round 4: fix the wrong answers, then score yourself

A self-scoring sheet gives marks for each round and a total out of 40. Below 28, revise the weakest lesson and retake the drill after two days.

Interviewers sometimes state something wrong on purpose to see whether you correct it politely. Fixing wrong answers trains you to spot the exact error and give the correct line.

Example 4 · Five wrong model answers, fixed

Text
1. "A switch is a layer 3 device that routes by IP."2. "UDP is reliable but faster than TCP."3. "HTTPS encrypts data with the certificate."4. "DNS uses TCP port 80."5. "NAT is a type of firewall that encrypts traffic."
Corrected
1. A basic switch is layer 2 and forwards frames by MAC address; routers route by IP.
2. UDP is not reliable: no ACKs, retransmission or ordering. It has lower delay.
3. The certificate proves the server's identity; data is encrypted with session keys agreed in the TLS handshake.
4. DNS uses port 53, normally over UDP, and TCP for large answers.
5. NAT translates private addresses to a public one; it does not encrypt and is not a firewall, though it blocks unrequested inbound traffic as a side effect.

What this code does

  • Each fix names the exact error and replaces it with the right fact, without a lecture. That is how to correct an interviewer politely.
  • Wrong statements like these are common traps because they are half true: switches can do layer 3 (layer 3 switches), and NAT does block some traffic.

Example 5 · Self-scoring sheet

NetworksScoreDemo.javaJava
import java.util.LinkedHashMap;import java.util.Map;
public class NetworksScoreDemo {    public static void main(String[] args) {        Map<String, int[]> rounds = new LinkedHashMap<>();        rounds.put("Rapid fire", new int[]{16, 20});        rounds.put("Subnetting", new int[]{6, 10});        rounds.put("URL journey", new int[]{4, 5});        rounds.put("Fix answers", new int[]{3, 5});
        int got = 0;        int max = 0;        String weakest = null;        double weakestPct = 101;        for (Map.Entry<String, int[]> e : rounds.entrySet()) {            int[] s = e.getValue();            double pct = 100.0 * s[0] / s[1];            System.out.printf("%-12s %2d / %2d  (%.0f%%)%n", e.getKey(), s[0], s[1], pct);            got += s[0];            max += s[1];            if (pct < weakestPct) {                weakestPct = pct;                weakest = e.getKey();            }        }        System.out.println("Total: " + got + " / " + max + (got >= 28 ? " -> ready" : " -> revise and retake"));        System.out.println("Revise first: " + weakest);    }}
Output
Rapid fire   16 / 20  (80%)
Subnetting    6 / 10  (60%)
URL journey   4 /  5  (80%)
Fix answers   3 /  5  (60%)
Total: 29 / 40 -> ready
Revise first: Subnetting

What this code does

  • Replace the sample marks with yours. The program totals the rounds, compares with the pass mark of 28 out of 40 and names the weakest round by percentage.
  • Retake the drill two days later with fresh subnetting numbers; tracking the total over three attempts shows real progress.

After all rounds, fill in the sheet and compare your total with the 28-mark line.

Marks per round:

  • Round 1: 20 marks (1 per question).
  • Round 2: 10 marks (2 per subnetting question).
  • Round 3: 5 marks (all eight beats in order, under 2 minutes, closing offer).
  • Round 4: 5 marks (1 per correctly fixed statement).

Find the bug

Correct the interviewer

Each note has one wrong line. Tap it, then check the polite correction.

Round 1 statements.

Round 1 of 3

Next step

Check your understanding

12 quick questions