Key terms: base case, call stack, collision, hash function, invariant, sentinel value
0 / 10 completed
1 / 10
A tech lead reviews a candidate's solution during a whiteboard interview and says: "Your algorithm works correctly, but its time complexity is O(n²) — that won't scale for large inputs." What does time complexity describe?
Time complexity describes how an algorithm's running time scales as the input size (n) grows — not the actual seconds, but the rate of growth. It's expressed in Big O notation: O(1) — constant time (doesn't depend on input size). O(log n) — logarithmic (binary search). O(n) — linear (single pass through array). O(n log n) — linearithmic (efficient sorting: merge sort, quicksort average). O(n²) — quadratic (naive nested loops: bubble sort, selection sort). O(2ⁿ) — exponential (brute-force recursive problems). The key insight: O(n²) is fine for n=100 but catastrophic for n=1,000,000. Space complexity (option B) describes how memory usage grows with input size — the same Big O notation applies. In interviews, candidates are routinely asked to "state the time and space complexity" of their solution. Example: "Sorting this list with merge sort gives us O(n log n) time and O(n) space."
2 / 10
A senior developer explains a coding technique: "This function calls itself with a smaller version of the problem until it reaches the base case." What programming concept is being described?
Recursion is a technique where a function solves a problem by calling itself with a simpler or smaller version of the problem, until a base case is reached that stops the chain. Classic recursive structures: factorial(n) = n × factorial(n-1), base case: factorial(0) = 1. Tree traversal (each node calls traversal on its children). Merge sort (split array, recursively sort halves, merge). Any recursive solution can also be written iteratively (using a loop). Key vocabulary: Base case — the terminating condition that stops recursion. Recursive call — the part where the function calls itself. Call stack — each recursive call adds a frame; too many without reaching the base case = stack overflow. Tail recursion — a recursive call is the last operation; some compilers optimise this to avoid stack growth. Iteration (option A) is the loop-based equivalent — generally more memory-efficient. Memoization (option C) is caching recursive sub-results — related but not the same concept. Polymorphism (option D) is an OOP concept (same method, different behaviour in subclasses) — unrelated.
3 / 10
During a code review, a comment reads: "We should use a hash map here instead of a list — lookups will be O(1) instead of O(n)." What is a hash map (also called a hash table or dictionary)?
A hash map (hash table, dictionary, associative array) stores data as key → value pairs and provides average O(1) lookup, insertion, and deletion — by computing a hash of the key to find the bucket directly. Implementations by language: Python: dict / JavaScript: Object or Map / Java: HashMap / C++: unordered_map / Go: map. Why O(1)? Rather than scanning all elements (as a list does), the hash function maps the key to a memory address directly. Key vocabulary: Hash function — converts a key to an integer index. Collision — two keys hash to the same index (handled by chaining or open addressing). Load factor — ratio of entries to buckets; high load factor → more collisions → degrades to O(n) in worst case. Trade-offs vs. sorted array (option A): hash maps have O(1) lookup but no ordering; sorted arrays have O(log n) search but maintain order. In interviews: "We can use a hash map to store seen values for O(n) total time instead of O(n²) for the nested loop approach."
4 / 10
An interviewer asks: "What is the difference between a stack and a queue?" Which answer is correct?
Stack — LIFO (Last In, First Out): The last element added is the first removed. Think of a stack of plates — you add and remove from the top. Operations: push (add to top), pop (remove from top), peek (view top without removing). Use cases: function call stack, undo/redo, expression parsing, DFS (depth-first search). Queue — FIFO (First In, First Out): The first element added is the first removed. Think of a queue at a coffee shop — first come, first served. Operations: enqueue (add to back), dequeue (remove from front). Use cases: task queues, BFS (breadth-first search), message queues (Kafka, RabbitMQ), printer spooling. Both can be implemented using arrays or linked lists. A Priority Queue is a variant where elements have priorities (implemented with a heap) — not strictly FIFO. In code: "The background job worker processes tasks using a queue — jobs are handled in the order they were submitted."
5 / 10
A developer says: "I added memoization to the recursive Fibonacci function — it went from exponential to linear time." What does memoization mean?
Memoization is an optimization technique that caches the return values of function calls, so that subsequent calls with the same arguments return the cached result instead of recomputing. It is the top-down approach to dynamic programming. Classic example — naive Fibonacci: fib(5) calls fib(4) + fib(3); fib(4) calls fib(3) + fib(2) — fib(3) is computed twice (and exponentially more for larger n) → O(2ⁿ). With memoization: "Have I computed fib(3) before? Yes — return the cached value." → O(n). Key vocabulary: Cache / memo table — the storage (usually a hash map) for computed results. Top-down DP — recursive with memoization. Bottom-up DP (tabulation) — iterative, fills a table from smallest to largest subproblem. Option A (iterative rewrite) is called bottom-up DP or iterative conversion — related but distinct. Option D describes divide and conquer — e.g., merge sort splits into independent halves. In practice: "The API response memoization layer prevents duplicate DB queries within the same request lifecycle."
6 / 10
Sarah (Lead Developer) posts a comment on a pull request: 'The validation logic here is overly complex. Can you refactor it to use a more declarative approach, perhaps with a Fluent Builder pattern?' What does the 'Fluent Builder' pattern typically aim to achieve in code design?
The Fluent Builder pattern is a design technique that focuses on readability and maintainability. It allows developers to build up complex objects or data structures in a more intuitive, step-by-step manner, reducing the risk of errors and making the code easier to understand and modify. The key benefit is a declarative style where operations are chained together.
7 / 10
Mark (Junior Developer) sends a message in Slack: 'I'm encountering a '500 Internal Server Error' when trying to deploy the new service. The logs show a 'NullPointerException' within the authentication module.' What is a NullPointerException typically indicating?
A NullPointerException signifies a common programming error where you're trying to use a reference (pointer) that doesn't point to an object—it's essentially dereferencing a null pointer. This often happens when a variable is declared but not initialized before being used, or when a method returns null without checking for it first.
8 / 10
David (Senior Developer) writes in a PR description: 'To improve the resilience of this API endpoint, we're implementing circuit breakers. This will prevent cascading failures if one service becomes unavailable.' What is a 'circuit breaker' pattern primarily used for?
Circuit breakers are a design pattern used to enhance system resilience. When a dependency (like an external service) fails repeatedly, the circuit breaker 'opens', temporarily preventing further requests to that dependency and allowing time for it to recover. This prevents cascading failures and improves overall system stability.
9 / 10
Emily (Developer) is discussing a design decision with her team: 'We need to ensure our microservice architecture remains loosely coupled. We should use an API Gateway to manage external access and route requests to the appropriate services.' What role does an 'API Gateway' typically play in this scenario?
An API Gateway acts as a central point of contact for clients interacting with microservices. It simplifies the external interface by handling tasks like routing requests to the correct service, performing authentication and authorization, and potentially managing rate limiting or other cross-cutting concerns. This decouples the client from the internal architecture.
10 / 10
Tom (DevOps Engineer) is explaining a monitoring dashboard: 'We're tracking the average response time of our API calls. A sudden spike indicates that a particular service might be overloaded or experiencing issues.' What is 'response time' typically measured and analyzed for in this context?
Response time is a key metric for evaluating API or service performance. It measures the total duration of a request—from when it's initiated by the client to when the server sends back the response. Monitoring response time helps identify bottlenecks and potential issues impacting user experience.
What does the "Computer Science Fundamentals Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to computer science fundamentals vocabulary through 10 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 10 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.