← 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. Which data structure is most efficient for implementing a priority queue?

    Answer: Binary Heap

    A binary heap supports O(log n) insertion and O(log n) extraction of the minimum/maximum, making it ideal for priority queues.

  2. What is the output of the following Python code? ``` def f(x, lst=[]): lst.append(x) return lst print(f(1)) print(f(2)) ```

    Answer: [1]\n[1, 2]

    Python default mutable arguments are shared across calls, so the same list persists between invocations.

  3. In Big-O notation, which represents the fastest growth rate?

    Answer: O(2ⁿ)

    Exponential time O(2ⁿ) grows faster than polynomial complexities like O(n²) or O(n³) for large n.

  4. What is a key difference between a shallow copy and a deep copy of an object?

    Answer: Deep copy duplicates nested objects; shallow copy only copies top-level references

    A shallow copy copies the container but not nested objects, which are still shared; a deep copy recursively copies everything.

  5. Which statement about recursion is TRUE?

    Answer: Every recursive function must have a base case to avoid infinite recursion

    A base case is required in recursion to stop the recursive calls; without it, the function calls itself indefinitely.

  6. What does `O(1)` space complexity mean for an algorithm?

    Answer: The algorithm's memory usage doesn't grow with input size

    O(1) space means the amount of extra memory used remains constant regardless of how large the input is.

  7. In a binary search algorithm, what is the prerequisite for the input array?

    Answer: The array must be sorted

    Binary search relies on comparing the target to the midpoint and eliminating half the array, which only works on a sorted array.