Daily Coding Quiz: Tuesday, 17 November 2026
All 10 coding questions with answers and explanations. 0 players took part.
Which sorting algorithm repeatedly swaps adjacent elements that are in the wrong order?
DSA · easy
- Merge sort
- Quick sort
- Bubble sort
- Heap sort
Answer: C. Bubble sort
Explanation: Bubble sort compares neighbours and swaps them, so large values “bubble” to the end on each pass. It is O(n²).
What does this return?
SQL · easy
SELECT name FROM employees WHERE name LIKE 'M%'; -- names: Asha, Ravi, Meera, Kabir, Neha- Meera
- Meera, Neha
- Asha, Meera
- No rows
Answer: A. Meera
Explanation: 'M%' matches names starting with M. % is any run of characters and _ is exactly one.
Which JOIN returns every row from the left table, with NULLs where there is no match on the right?
SQL · easy
- INNER JOIN
- LEFT JOIN
- CROSS JOIN
- SELF JOIN
Answer: B. LEFT JOIN
Explanation: LEFT (OUTER) JOIN keeps all left rows. INNER JOIN keeps only rows that match on both sides.
What is the space complexity of a recursive DFS on a tree of height h (ignoring the output)?
DSA · medium
- O(1)
- O(h)
- O(n log n)
- O(2^h)
Answer: B. O(h)
Explanation: The call stack holds one frame per level on the current root-to-node path, so at most h + 1 frames.
Which statements are true about a VIEW? (Select all that apply)
SQL · medium
- It is a stored query
- By default it does not store a copy of the data
- It always makes queries faster
- It can hide columns from users
Answer: A. It is a stored query; B. By default it does not store a copy of the data; D. It can hide columns from users
Explanation: A view is a named SELECT that runs when queried, so it is not automatically faster (materialized views, which store results, are a different feature). Views are often used to expose only some columns.
Table A has 3 rows and table B has 4 rows. How many rows does SELECT * FROM A CROSS JOIN B return?
SQL · medium
- 7
- 12
- 4
- 3
Answer: B. 12
Explanation: A cross join pairs every row of A with every row of B: 3 × 4 = 12 (a Cartesian product).
What does this return?
SQL · medium
-- Table employees(id, name, dept, salary): -- (1, Asha, Eng, 90) -- (2, Ravi, Eng, 70) -- (3, Meera, Sales, 60) -- (4, Kabir, Sales, 60) -- (5, Neha, HR, NULL) SELECT dept, COUNT(*) AS n FROM employees GROUP BY dept HAVING COUNT(*) > 1 ORDER BY dept;- Eng 2, Sales 2
- Eng 2, HR 1, Sales 2
- Sales 2
- Eng 2
Answer: A. Eng 2, Sales 2
Explanation: Eng and Sales have 2 employees each; HR has 1 and is filtered out by HAVING.
What is the minimum number of comparisons any comparison-based sort needs in the worst case?
DSA · hard
- Θ(n)
- Θ(n log n)
- Θ(n²)
- Θ(log n)
Answer: B. Θ(n log n)
Explanation: There are n! possible orders, and a decision tree with n! leaves has height ≥ log₂(n!) = Θ(n log n). Counting sort beats this only by not comparing.
What does this return?
SQL · hard
SELECT * FROM a WHERE id NOT IN (SELECT a_id FROM b); -- a.id: 1, 2, 3 -- b.a_id: 1, NULL- 2, 3
- No rows
- 1
- 1, 2, 3
Answer: B. No rows
Explanation: id NOT IN (1, NULL) means id <> 1 AND id <> NULL. Comparing with NULL is unknown, so no row qualifies. NOT EXISTS does not have this trap.
What does the running total return for the third row?
SQL · hard
SELECT d, amt, SUM(amt) OVER (ORDER BY d) AS running FROM sales; -- rows (d, amt): ('2026-01-01', 10), ('2026-01-02', 20), ('2026-01-02', 5), ('2026-01-03', 7)- 30
- 35
- 5
- 42
Answer: B. 35
Explanation: With ORDER BY and no frame clause the default frame is RANGE … CURRENT ROW, which includes all peers with the same d. Both 2026-01-02 rows show 10 + 20 + 5 = 35. Use ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW for a strict row-by-row total.