โ† All CodeSignal Technical Assessment Flashcard Decks

Coding Fundamentals Flashcards

7 cards from real CodeSignal Technical Assessment practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Coding Fundamentals flashcards as text
  1. What is memoization in the context of dynamic programming?

    Answer: Caching the results of expensive function calls to avoid redundant computation

    Memoization stores previously computed results so that when the same inputs occur again, the cached result is returned instead of recomputing.

  2. In Python, what is the difference between `is` and `==`?

    Answer: `is` checks identity (same object in memory); `==` checks value equality

    `is` tests whether two variables point to the same object in memory, while `==` tests whether their values are equal.

  3. Which of the following best explains the concept of 'amortized time complexity'?

    Answer: The average time per operation over a sequence of operations, smoothing out occasional expensive operations

    Amortized analysis averages the cost of operations over time, allowing occasional expensive operations as long as the long-run average is cheap.

  4. What does a breadth-first search (BFS) use internally to track nodes to visit?

    Answer: Queue

    BFS uses a queue (FIFO) to explore nodes level by level, ensuring nodes closer to the source are visited first.

  5. What is the purpose of the modulo operator `%` in programming?

    Answer: Returns the remainder after division

    The modulo operator returns the remainder when one number is divided by another, e.g., `7 % 3 = 1`.

  6. Which of the following describes a 'greedy algorithm'?

    Answer: An algorithm that makes the locally optimal choice at each step hoping to reach a global optimum

    Greedy algorithms choose the best available option at each step without reconsidering past choices, which works optimally for some problems like Dijkstra's shortest path.

  7. In Python, what is the time complexity of the `in` operator for a list vs. a set?

    Answer: O(n) for list, O(1) average for set

    List membership testing requires scanning all elements (O(n)), while set membership uses a hash table for O(1) average-case lookup.