FREE System Design and Architecture Questions and Answers
You are given an array [2, 7, 11, 15] and a target 9. Which pair of indices will sum up to the target?
Correct!
Wrong!
The numbers at indices 0 and 1 are 2 and 7, respectively, and their sum is 9, which matches the target.
Which of the following sorting algorithms has the best average-case time complexity?
Correct!
Wrong!
Merge Sort has an average-case time complexity of O(n log n), while Bubble Sort and Selection Sort have O(n²). Quick Sort can degrade to O(n²) in the worst case.
Which type of SQL join returns all records from the left table and matching records from the right table?
Correct!
Wrong!
A LEFT JOIN retrieves all rows from the left table and only matching rows from the right table. Non-matching rows from the right table are filled with NULL.
What is the time complexity of traversing a singly linked list with n elements?
Correct!
Wrong!
In a singly linked list, each node is visited sequentially, making traversal a linear-time operation, O(n).
Consider the following Python function: def add_numbers(a, b): return a + b print(add_numbers(2))
Correct!
Wrong!
The function add_numbers expects two arguments, a and b, but only one is provided when calling add_numbers(2). This results in a TypeError.