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
What is the result of evaluating `2 ** 3 ** 2` in Python?
Answer: 512
The exponentiation operator `**` is right-associative, so `3 ** 2 = 9` is computed first, then `2 ** 9 = 512`.
Which of the following is an example of a graph traversal algorithm?
Answer: Depth-First Search (DFS)
DFS is a graph traversal algorithm that explores as far as possible along each branch before backtracking.
What is a key property of a linked list compared to an array?
Answer: Linked lists allow O(1) insertion at the head without shifting elements
Inserting at the head of a linked list is O(1) because only the pointer is updated, unlike arrays that require shifting all elements.
In Python, what does the `yield` keyword do in a function?
Answer: Pauses execution and returns a value, making the function a generator
`yield` turns a function into a generator, pausing execution at that point and resuming when the next value is requested.
What does it mean for a function to be 'idempotent'?
Answer: Calling it multiple times with the same input always produces the same result without side effects
An idempotent function produces identical results for the same inputs no matter how many times it is called.
Which of the following best describes a two-pointer technique?
Answer: Using two variables to track array boundaries and moving them toward each other to solve problems efficiently
The two-pointer technique uses two indices that start at different positions and converge, reducing O(n²) solutions to O(n) for problems like pair-sum.
What is the worst-case time complexity of searching for a value in an unbalanced Binary Search Tree?
Answer: O(n)
In the worst case, an unbalanced BST degenerates into a linked list, requiring O(n) time to search.