Skip to content
Tutorials Center
My learning

Topics

Lesson 76 of 77 ยท Interview Day

Rapid-Fire Questions: 100 Short Answers

One hundred short interview answers across JavaScript, Python, Java, C++, systems, web, databases, algorithms, security and tools, plus a self-quiz you can run.

Some interviews open with a burst of quick questions: "What is a closure? What does == do differently from ===? What is a deadlock?" The interviewer wants a clear one- or two-sentence answer in thirty seconds, and then they will decide where to dig deeper. People who know the topic still stumble here because they have never said the answer out loud in short form.

This lesson gives you 100 short answers, grouped by subject, to read, cover up and say aloud. Each answer is a starting point, not the whole story; the lessons earlier in this track explain the details and traps. Afterward you can run two small self-quiz tools. The questions are real; the code is only a flashcard stand-in.

How to use this list

Practice the short form

Cover Hide the answer, read the question.
Say it Answer out loud in 20 seconds.
Check Compare, then mark right or wrong.
Repeat Review the misses tomorrow.

Pair this with the schedule from the study plan lesson.

1 / 2

A good short answer has a definition and one differentiator ("it is X, unlike Y"). If the interviewer wants more, they will ask. For long answers, use the structure from the answering framework.

JavaScript (1-10)

  1. What does typeof null return? "object". It is a long-standing historical bug that cannot be fixed without breaking the web.
  2. == versus ===? == converts types before comparing; === compares without conversion. Prefer ===.
  3. What is a closure? A function that keeps access to the variables of the scope where it was created, even after that scope has finished.
  4. var versus let and const? var is function-scoped and hoisted as undefined; let and const are block-scoped and sit in the temporal dead zone until declared.
  5. Is NaN === NaN true? No. Use Number.isNaN(x) or Object.is(x, NaN).
  6. Which runs first, a promise callback or a setTimeout(fn, 0) callback? The promise callback: microtasks run before the next macrotask.
  7. What is this in an arrow function? It is taken from the surrounding scope; arrow functions have no own this.
  8. call, apply and bind? call runs a function with a given this and listed arguments, apply takes an array of arguments, bind returns a new function with this fixed.
  9. Promise.all versus Promise.allSettled? all rejects as soon as one promise rejects; allSettled waits for all and reports each outcome.
  10. Shallow versus deep copy? A shallow copy duplicates only the top level, so nested objects are shared; structuredClone makes a deep copy.

Python (11-20)

  1. is versus ==? is tests identity (same object); == tests equality of value.
  2. Why is def f(x=[]) a trap? The default list is created once at definition time and shared by every call that uses it.
  3. List versus tuple? Lists are mutable; tuples are immutable (and hashable if their items are).
  4. What is the GIL? In the default CPython build, a lock that lets only one thread run Python bytecode at a time, so threads do not speed up CPU-bound work.
  5. What is a generator? A function using yield that produces values lazily, one at a time, keeping its state between calls.
  6. What is a decorator? A callable that takes a function and returns a replacement; functools.wraps keeps the original name and docstring.
  7. What is the MRO? The method resolution order, a linear order of classes (C3 linearization) used to find attributes; inspect it with Class.__mro__.
  8. Do dicts keep order? Yes, insertion order is guaranteed since Python 3.7.
  9. What does with do? It calls __enter__ on entry and __exit__ on exit, even after an exception, so cleanup is guaranteed.
  10. What makes an object hashable? It has a __hash__ that is consistent with __eq__ and does not change during its life; lists and dicts are not hashable.

Java (21-30)

  1. The equals/hashCode contract? Equal objects must return equal hash codes; override both together.
  2. Why are strings immutable? It makes them safe to share, cache (the string pool) and use as hash keys.
  3. Interface versus abstract class? A class can implement many interfaces but extend one class; abstract classes can hold instance state.
  4. How does HashMap find a key? It hashes the key to a bucket, then compares keys with equals; average lookup is O(1).
  5. ArrayList versus LinkedList? ArrayList is backed by an array (fast index access); LinkedList is a doubly linked list. ArrayList is the better default.
  6. What does final mean? On a variable: no reassignment; on a method: no overriding; on a class: no subclassing.
  7. What does volatile guarantee? Visibility of writes between threads and ordering, but not atomicity of compound actions like count++.
  8. Checked versus unchecked exceptions? Checked ones must be declared or caught; unchecked ones (RuntimeException and subclasses) need not be.
  9. What does the garbage collector free? Objects that are no longer reachable from any live reference.
  10. What is a record? A compact way to declare an immutable data class, with generated constructor, accessors, equals, hashCode and toString.

C, C++ and operating systems (31-45)

  1. What is a pointer? A variable that holds a memory address.
  2. Stack versus heap? The stack holds automatic, scoped variables and is fast; the heap holds dynamically allocated memory that you (or an owner object) must release.
  3. Dangling pointer? A pointer to memory that has been freed or has gone out of scope.
  4. Memory leak? Memory that was allocated but never released, so it cannot be reused.
  5. Undefined behavior? Code for which the language sets no requirements, such as out-of-bounds access or signed overflow; the program may appear to work and then fail.
  6. What is RAII? Tying a resource's lifetime to an object's lifetime, so the destructor always releases it.
  7. unique_ptr versus shared_ptr? unique_ptr has a single owner and is move-only; shared_ptr is reference-counted shared ownership.
  8. How do virtual functions work? A call goes through the object's vtable, so the override of the real (dynamic) type runs.
  9. What is the rule of five? If a class needs a custom destructor, copy or move operation, it probably needs all five: destructor, copy constructor, copy assignment, move constructor, move assignment.
  10. What are move semantics? Transferring a resource from a temporary or expiring object instead of copying it.
  11. Process versus thread? A process has its own address space; threads of a process share memory.
  12. The four deadlock conditions? Mutual exclusion, hold and wait, no preemption, circular wait.
  13. Mutex versus semaphore? A mutex is a lock owned by one holder at a time; a semaphore is a counter that allows up to N holders.
  14. What is a context switch? Saving one task's CPU state and loading another's so the CPU can switch between them.
  15. What is paging? Dividing virtual memory into fixed-size pages that the OS maps to physical frames on demand.

Web and networking (46-60)

  1. TCP versus UDP? TCP is connection-based, ordered and reliable; UDP is connectionless and lightweight, with no delivery guarantee.
  2. 401 versus 403? 401 means you are not authenticated; 403 means you are authenticated but not allowed.
  3. 301 versus 302? 301 is a permanent redirect; 302 is a temporary one.
  4. What is HTTPS? HTTP carried over TLS, which encrypts traffic and verifies the server's identity.
  5. What does DNS do? It translates domain names into IP addresses.
  6. What is CORS? A browser mechanism where a server uses response headers to say which other origins may read its responses.
  7. Why semantic HTML? Elements like <nav> and <button> give meaning to browsers, assistive technology and search engines.
  8. The box model? Every element is content plus padding, border and margin.
  9. How is CSS specificity ranked? Inline styles, then IDs, then classes/attributes/pseudo-classes, then elements; ties go to the later rule.
  10. Flexbox versus grid? Flexbox lays out in one dimension (a row or a column); grid works in two.
  11. What is the virtual DOM? An in-memory description of the UI that React compares between renders to update the real DOM minimally.
  12. Why do list items need keys? Keys let React match items between renders, so state and DOM nodes follow the right item.
  13. Props versus state? Props are inputs passed from a parent; state is data a component owns and can change.
  14. What is useEffect for? Running side effects (subscriptions, requests) after render, with a cleanup function and a dependency array.
  15. Cookies versus localStorage? Cookies are sent with matching requests and can be HttpOnly; localStorage stays in the browser and is readable by any script on the page.

Databases (61-70)

  1. INNER JOIN versus LEFT JOIN? Inner keeps only matching rows; left keeps every row from the left table, with nulls where there is no match.
  2. WHERE versus HAVING? WHERE filters rows before grouping; HAVING filters groups after aggregation.
  3. What does an index do? It speeds up lookups (usually with a B-tree) at the cost of slower writes and extra space.
  4. What does ACID stand for? Atomicity, consistency, isolation, durability.
  5. Primary key versus foreign key? A primary key uniquely identifies a row; a foreign key references a key in another table.
  6. Why normalize? To avoid duplicated data and update anomalies, by storing each fact in one place.
  7. DELETE, TRUNCATE, DROP? DELETE removes chosen rows, TRUNCATE empties a table, DROP removes the table itself.
  8. What is the CAP theorem? When a network partition happens, a distributed system must choose between consistency and availability.
  9. Sharding versus replication? Sharding splits data across nodes; replication copies the same data to several nodes.
  10. Cache-aside? The application reads the cache first, loads from the database on a miss, then stores the result in the cache. LRU evicts the least recently used entry.

Algorithms and data structures (71-80)

  1. Binary search complexity? O(log n), and the data must be sorted.
  2. Hash table lookup cost? O(1) on average, O(n) in the worst case with many collisions.
  3. Stack versus queue? A stack is last-in first-out; a queue is first-in first-out.
  4. BFS versus DFS? BFS explores level by level with a queue and finds shortest paths in unweighted graphs; DFS goes deep first with a stack or recursion.
  5. Quicksort versus merge sort? Quicksort averages O(n log n) with an O(n^2) worst case; merge sort is always O(n log n), stable, and needs extra space.
  6. What does a binary heap give you? Reading the minimum (or maximum) in O(1) and insert or remove in O(log n).
  7. When does dynamic programming apply? When a problem has overlapping subproblems and optimal substructure.
  8. What is the sliding window? Moving two ends over an array to keep a running answer without recomputing from scratch.
  9. Topological sort? An ordering of a directed acyclic graph's nodes so every edge points forward.
  10. Dijkstra's limitation? It needs non-negative edge weights.

Design, security and tools (81-100)

  1. What are the SOLID principles? Single responsibility, open/closed, Liskov substitution, interface segregation, dependency inversion.
  2. Composition versus inheritance? Composition builds behavior from parts ("has a"); inheritance reuses by extension ("is a"). Prefer composition when in doubt.
  3. Singleton? A class with one instance and a global access point; use sparingly because it hides dependencies and complicates tests.
  4. Observer pattern? Subscribers register with a subject and get notified when it changes.
  5. Strategy pattern? Swap interchangeable algorithms behind one interface.
  6. Hashing versus encryption? Hashing is one-way; encryption is reversible with a key.
  7. How to store passwords? As salted hashes from a slow algorithm such as bcrypt, scrypt or Argon2, never as plain text.
  8. What is XSS? Cross-site scripting: an attacker gets their script to run on your page; defend with output escaping and a content security policy.
  9. What is CSRF? Tricking a logged-in browser into sending an unwanted request; defend with anti-forgery tokens and SameSite cookies.
  10. How to stop SQL injection? Use parameterized queries, never string concatenation.
  11. Is a JWT encrypted? Usually not: it is signed, so anyone can read the payload but cannot change it without detection.
  12. git merge versus git rebase? Merge joins histories with a merge commit; rebase replays your commits on a new base for a linear history.
  13. git reset versus git revert? Reset moves the branch pointer (rewriting history); revert adds a new commit that undoes an old one.
  14. Docker image versus container? An image is a read-only template; a container is a running instance of it.
  15. What are CI and CD? Continuous integration builds and tests every change; continuous delivery or deployment releases changes automatically or on demand.
  16. What does a load balancer do? Spreads requests across servers and routes around failed ones.
  17. Mock versus stub? A stub supplies canned answers; a mock also verifies how it was called.
  18. What is idempotency? Repeating an operation has the same effect as doing it once; PUT and DELETE are meant to be idempotent, plain POST is not.
  19. How does a token bucket limit rates? Tokens refill at a steady rate up to a cap; each request spends one, and with none left the request is rejected or delayed.
  20. What does a CDN do? Serves cached copies of content from servers near the user, cutting latency and origin load.

A self-quiz you can run

This stand-in picks a repeatable set of cards with a small seeded shuffle, "answers" each from a made-up list of your responses, and reports the score. It models the idea of a flashcard deck; it does not grade free text.

JS A seeded flashcard round

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second tool grades a free-text answer by looking for key ideas. Real interviewers listen for meaning, not keywords, so this is a rough practice aid: it helps you check that your short answer contains the one or two ideas that matter.

JS Check that an answer contains the key ideas

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the best shape for a rapid-fire answer?

    A short definition with one point that sets it apart from the nearest concept shows understanding and leaves room for follow-ups.
  2. 2. Which statement about HTTP status codes is correct?

    401 is about missing or invalid credentials, 403 about missing permission, and 301 is the permanent redirect.
  3. 3. Which pair is correctly matched?

    BFS processes nodes in the order they were discovered (a queue); DFS goes deep and backtracks (stack or recursion).
  4. 4. What does a JWT usually provide?

    The signature proves integrity; the payload is only base64-encoded, so do not put secrets in it.

Summary

  • Rapid-fire rounds test whether you can state a core idea clearly in one or two sentences.
  • Answer with a definition plus a differentiator; offer detail only when asked.
  • Practice by covering the answer, saying yours aloud, and marking misses for the next review.
  • The 100 answers above span JavaScript, Python, Java, C++, systems, web, databases, algorithms, security and tools; revisit the topic lessons for anything you could not explain further.
  • The self-quiz tools are stand-ins for flashcards: seeded shuffling and keyword checks, not a replacement for a human listener.

Next, condense it all into Interview Cheat Sheet.