InterviewGrind Get notified

InterviewGrind › CS fundamentals

Computer Science Fundamentals Interview Questions

Concurrency, memory, networking, operating systems and databases: the CS fundamentals that come up in technical interviews, explained without the textbook padding.

15 free questions from the app. Try each one before you open the answer.

1. Operating systemsEasy

Browsers run each tab as a separate process, not a thread, so one crashing tab can't take down the others. What's the key difference that makes that work?

  1. Threads share their process's memory; processes are isolated
  2. Processes are always faster to start than threads
  3. Threads can't run in parallel
  4. Processes can't communicate with each other
Show answer

Answer: A. Threads share their process's memory; processes are isolated

Threads share the heap and globals of their process, so communication is cheap but needs synchronization. Processes are isolated, so a crash in one doesn't corrupt another, but communicating needs IPC (pipes, sockets, shared memory).

2. DNSEasy

Walk me through DNS. You type example.com. Where does your computer look first?

  1. The root name servers, which know the address of every domain
  2. Local caches: the browser's, then the operating system's
  3. The .com servers
  4. example.com's own authoritative name server
Show answer

Answer: B. Local caches: the browser's, then the operating system's

Most lookups never leave your machine: the browser and OS cache recent answers until their TTL expires.

3. NetworkingEasy

Which transport fits a live video call best, and why?

  1. TCP, because every single video frame must arrive, and in order
  2. UDP, because a late frame is useless and resending adds lag
  3. TCP, because UDP can't carry video data
  4. UDP, because it encrypts packets by default
Show answer

Answer: B. UDP, because a late frame is useless and resending adds lag

TCP guarantees order and delivery, so one lost packet stalls everything behind it. In a live call, it's better to drop a frame and keep going. That's why real-time media uses UDP-based protocols.

4. ConcurrencyEasy

Two threads update the same account balance and money goes missing. You wrap the update in a mutex. What does the mutex do?

  1. Lets only one thread at a time run a protected section of code
  2. Makes the update run on multiple cores at once
  3. Speeds up memory access
  4. Schedules threads in round-robin order
Show answer

Answer: A. Lets only one thread at a time run a protected section of code

A thread locks the mutex before touching shared data and unlocks it afterwards; others wait. Keep critical sections short, and always unlock (use RAII guards or try/finally).

5. HTTPEasy

What's the difference between HTTP 401 and 403?

  1. 401: not logged in. 403: logged in, but not allowed
  2. 401: the page doesn't exist. 403: the server crashed
  3. They mean the same thing
  4. 401: too many requests. 403: bad request body
Show answer

Answer: A. 401: not logged in. 403: logged in, but not allowed

401 Unauthorized really means unauthenticated: log in and retry. 403 Forbidden means authenticated but lacking permission; logging in again won't help.

6. NetworkingEasy

Myth or fact: HTTP/3, used for a large share of web traffic, runs over UDP.

  1. Myth
  2. Fact
Show answer

Answer: B. Fact

Fact. HTTP/3 runs on QUIC, which is built on UDP and adds its own reliability, ordering per stream and encryption. DNS uses UDP too. UDP leaves reliability to the layer above, which can then make smarter trade-offs than TCP.

7. ConcurrencyEasy

Myth or fact: adding more threads always makes a CPU-bound program faster.

  1. Myth
  2. Fact
Show answer

Answer: A. Myth

Myth. Once threads outnumber CPU cores, they take turns, and context switches and cache misses add overhead. For CPU-bound work, about one thread per core is the usual sweet spot.

8. MemoryEasy

Deep recursion crashes with a stack overflow, yet allocating a 1 GB list works fine. What's the difference between stack and heap memory?

  1. The stack holds call frames freed on return; the heap holds longer-lived data
  2. The stack lives on disk and the heap lives in RAM
  3. The heap is always faster, so big data goes there
  4. Only the stack can store objects; the heap stores numbers
Show answer

Answer: A. The stack holds call frames freed on return; the heap holds longer-lived data

Stack allocation is just moving a pointer, so it's very fast, but its size is limited and data dies when the function returns. The heap is flexible and larger, but allocation costs more and must be managed.

9. HTTPEasy

HTTP is stateless. How do websites keep you logged in between requests?

  1. A cookie or token sent with each request identifies your session
  2. The server remembers your IP address for the whole browsing session
  3. HTTP keeps one connection open for your whole visit
  4. Your password is sent with every request
Show answer

Answer: A. A cookie or token sent with each request identifies your session

After login, the server issues a session ID (looked up server-side) or a signed token (such as a JWT). Mark cookies HttpOnly and Secure so scripts can't read them and they're never sent unencrypted.

10. Operating systemsMedium

Under load, your service starts failing with "Too many open files", even though it opens very few files. What's the likely cause?

  1. The disk is full, so new files can't be created
  2. Each socket uses a file descriptor, and connections aren't closed
  3. The service has too many threads, and each one holds its own open files
  4. A log file is locked by another process
Show answer

Answer: B. Each socket uses a file descriptor, and connections aren't closed

On Unix every socket is a file descriptor. Leaked HTTP or database connections, or a low ulimit -n, exhaust the per-process limit. Close or pool connections, and raise the limit for servers that genuinely need many sockets.

11. SecurityMedium

On a coffee-shop Wi-Fi, what does HTTPS protect?

  1. Your requests' contents, and proof you reached the real server
  2. Everything, including which website and which pages you're visiting
  3. Nothing; HTTPS only makes pages load faster
  4. Only the password field on login forms
Show answer

Answer: A. Your requests' contents, and proof you reached the real server

TLS encrypts the whole HTTP exchange (URL paths, headers, bodies) and authenticates the server with its certificate. The domain name can still leak through DNS and the TLS handshake (SNI) unless encrypted DNS and ECH are used.

12. LatencyMedium

Roughly how long is a network round trip from New York to London?

  1. About 0.7 ms
  2. About 7 ms
  3. About 70 ms
  4. About 700 ms
Show answer

Answer: C. About 70 ms

Light in fiber covers about 200 km per millisecond. 5,600 km each way is about 28 ms, so at least 56 ms round trip; real routes land around 70 ms. That's why chatty protocols with many round trips feel slow across oceans.

13. Operating systemsMedium

What is a key benefit of virtual memory?

  1. Each process gets an isolated address space, pageable to disk
  2. It makes the CPU faster at reading memory
  3. It removes the need for physical RAM
  4. It lets processes freely read and write each other's memory
Show answer

Answer: A. Each process gets an isolated address space, pageable to disk

The OS and hardware (MMU) map each process's virtual addresses to physical pages. That gives isolation (a bug in one process can't corrupt another) and flexibility, at the cost of page-table lookups that the TLB caches.

14. Operating systemsMedium

What does it mean when a process is in the "blocked" (waiting) state?

  1. It's waiting for an event like I/O, so it gets no CPU time
  2. It has crashed and is waiting to be cleaned up
  3. It's using 100% CPU in a tight loop
  4. It has been paused by the user with Ctrl+Z
Show answer

Answer: A. It's waiting for an event like I/O, so it gets no CPU time

The main states are running, ready (could run, waiting for a CPU) and blocked (waiting for something else). Blocked processes don't consume CPU, which is how one core juggles many I/O-heavy programs.

15. NetworkingMedium

You moved your site to a new IP address, but some users still reach the old server for hours. Why?

  1. DNS resolvers cached the old record until its TTL expires
  2. The new server is too slow, so requests time out back to the old one
  3. Browsers can't handle new IP addresses
  4. HTTPS certificates block the change
Show answer

Answer: A. DNS resolvers cached the old record until its TTL expires

Every DNS record has a time-to-live. Before a planned migration, lower the TTL (say to 60 seconds) a day ahead, then switch, then raise it again.

Practise like this every day

InterviewGrind gives you ten questions like these each day on your iPhone, with Pro tracks for company-style loops.

Get the launch email