Cisco interview prep
10 practice questions on the topics candidates reported from Cisco interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 2
-
An LFU cache evicts the least frequently used key, breaking ties by the least recently used. What gives O(1) get and put?
- A single sorted array of keys by frequency
- A binary search tree ordered by frequency, which is O(1)
- A hash map from key to node, a hash map from frequency to a doubly linked list of keys with that frequency, and the current minimum frequency
- Scanning every key to find the least used one
Show the answer
C. A hash map from key to node, a hash map from frequency to a doubly linked list of keys with that frequency, and the current minimum frequency
A hit moves the key from list f to list f + 1. Each list is in recency order, so evicting takes the oldest key in the min-frequency list, and min resets to 1 when a new key arrives.
This topic is named in a candidate’s interview report: Technical intern assessment, 2026, on Reddit.
-
Kadane's algorithm finds the maximum sum of a contiguous subarray. For [-2, 1, -3, 4, -1, 2, 1, -5, 4], what is that sum and which indices does it cover?
- 6, indices 3 to 6
- 7, indices 3 to 8
- 5, indices 0 to 6
- 4, index 3 only
Show the answer
A. 6, indices 3 to 6
Keep the best sum ending at each index: extend the previous run if it is positive, otherwise start again. The best run is 4, -1, 2, 1 at indices 3 to 6, summing to 6, in one O(n) pass.
This topic is named in a candidate’s interview report: Technical intern assessment, 2026, on Reddit.
Python 1
-
What does this print?
def same(a, b): if len(a) != len(b): return False diff = 0 for x, y in zip(a, b): diff |= ord(x) ^ ord(y) return diff == 0 print(same("cisco", "cisco"), same("cisco", "cisko"))- True True
- True False
- False False
- False True
Show the answer
B. True False
x ^ y is 0 exactly when two characters are equal, and OR-ing every result keeps any non-zero bit, so diff stays 0 only if all pairs match. "c" ^ "k" is not 0. Walking every character instead of stopping at the first difference is how constant-time comparison of secrets works.
This topic is named in a candidate’s interview report: Software engineer on-campus interview, 2024, on GeeksforGeeks.
C and C++ 2
-
A non-member function is declared friend inside class Account. Which statement is true?
- It can use Account's private and protected members, although it is not a member function and has no this pointer
- It becomes a member function of Account
- Classes derived from Account inherit the friendship
- It can still see only Account's public members
Show the answer
A. It can use Account's private and protected members, although it is not a member function and has no this pointer
friend grants access, not membership. The function is called like any free function and receives the object as an argument. Friendship is neither inherited nor transitive.
This topic is named in a candidate’s interview report: Summer intern on-campus interview, on GeeksforGeeks.
-
How do C++ compilers usually make a virtual function call through a base-class pointer reach the right override?
- They inline every virtual call
- Each object of a class with virtual functions holds a pointer to its class's vtable, a table of function pointers read at run time
- They look the function up by name at run time
- They generate a template for every derived class
Show the answer
B. Each object of a class with virtual functions holds a pointer to its class's vtable, a table of function pointers read at run time
A call such as p->area() loads the vtable pointer from the object, then the slot for area, then calls it. That indirection is why virtual calls are slightly slower and usually cannot be inlined.
This topic is named in a candidate’s interview report: Summer intern on-campus interview, on GeeksforGeeks.
Computer networks 5
-
At which OSI layer does IP routing happen?
- Data link (2)
- Network (3)
- Transport (4)
- Application (7)
Show the answer
B. Network (3)
Routers read IP addresses and forward packets between networks at layer 3. Switches work at layer 2 with MAC addresses.
This topic is named in a candidate’s interview report: Software engineer full-time on-campus interview, 2022, on GeeksforGeeks.
-
What is the TTL field in an IP packet for?
- Each router lowers it by one and drops the packet at zero, so packets cannot loop forever
- It sets how long a website may cache the page
- It is the packet's timestamp
- It sets the TCP retransmission timeout
Show the answer
A. Each router lowers it by one and drops the packet at zero, so packets cannot loop forever
Time to live is a hop count. A routing loop would otherwise circulate a packet indefinitely. traceroute uses it: it sends packets with TTL 1, 2, 3 and records which router reports each one expired.
This topic is named in a candidate’s interview report: Software engineer on-campus interview, 2021, on GeeksforGeeks.
-
How do a hub, a switch and a router differ?
- They are three names for the same device
- A hub repeats every frame to every port; a switch learns MAC addresses and sends a frame only to the right port; a router forwards packets between networks by IP address
- A hub routes by IP, a router by MAC
- A switch connects to the internet, a router only within a room
Show the answer
B. A hub repeats every frame to every port; a switch learns MAC addresses and sends a frame only to the right port; a router forwards packets between networks by IP address
A hub works at the physical layer and makes one big collision domain. A switch is a layer 2 device keyed on MAC addresses. A router is layer 3: it reads the destination IP, looks up its routing table and sends the packet toward another network.
This topic is named in a candidate’s interview report: Software engineer on-campus interview, 2024, on GeeksforGeeks.
-
What does DHCP do, as against DNS?
- DHCP turns domain names into IP addresses; DNS hands out addresses
- DHCP gives a joining device its IP address, subnet mask, gateway and DNS server; DNS turns names like cisco.com into IP addresses
- Both encrypt traffic
- DHCP is the secure version of DNS
Show the answer
B. DHCP gives a joining device its IP address, subnet mask, gateway and DNS server; DNS turns names like cisco.com into IP addresses
A laptop joining Wi-Fi broadcasts a DHCP Discover and gets a lease (Discover, Offer, Request, Acknowledge). Later, every name it looks up goes to the DNS server that lease told it about.
This topic is named in a candidate’s interview report: Software engineer on-campus interview, 2024, on GeeksforGeeks.
-
How do the layers of the TCP/IP model line up with the OSI model?
- TCP/IP has the same seven layers
- TCP/IP's application layer covers OSI application, presentation and session; transport and internet match OSI transport and network; the link layer covers data link and physical
- TCP/IP has no transport layer
- OSI is what the internet runs on; TCP/IP is only a teaching model
Show the answer
B. TCP/IP's application layer covers OSI application, presentation and session; transport and internet match OSI transport and network; the link layer covers data link and physical
It is the other way round for the last option: the internet runs TCP/IP, and OSI is the seven-layer reference model used to talk about it. HTTP sits in TCP/IP's application layer, TCP and UDP in transport, IP in the internet layer, Ethernet and Wi-Fi in the link layer.
This topic is named in a candidate’s interview report: Software engineer on-campus interview, 2024, on GeeksforGeeks.