Daily Coding Quiz: Monday, 16 November 2026
All 10 coding questions with answers and explanations. 0 players took part.
Which data structure does breadth-first search (BFS) use to decide which node to visit next?
DSA · easy
- Stack
- Queue
- Priority queue
- Hash set
Answer: B. Queue
Explanation: BFS explores level by level: nodes are visited in the order they were discovered, which is exactly a FIFO queue. DFS uses a stack (or recursion).
What is printed?
Python · easy
nums = [1, 2, 3, 4, 5] print(nums[1:4])- [1, 2, 3, 4]
- [2, 3, 4]
- [2, 3, 4, 5]
- [1, 2, 3]
Answer: B. [2, 3, 4]
Explanation: Slices include the start index and exclude the end: indexes 1, 2 and 3.
Which of these is immutable?
Python · easy
- list
- dict
- set
- tuple
Answer: D. tuple
Explanation: A tuple cannot be changed after it is created, which is also why tuples (of hashable items) can be dictionary keys.
Kadane’s algorithm finds:
DSA · medium
- The longest increasing subsequence
- The maximum sum of a contiguous subarray
- The shortest path in a DAG
- The k-th smallest element
Answer: B. The maximum sum of a contiguous subarray
Explanation: Track the best sum ending at each index: max(x, best_ending_here + x). The best of those is the answer, in one O(n) pass.
What is printed?
Python · medium
a = [[0] * 2] * 2 a[0][0] = 1 print(a)- [[1, 0], [0, 0]]
- [[1, 0], [1, 0]]
- [[1, 1], [0, 0]]
- An error
Answer: B. [[1, 0], [1, 0]]
Explanation: * 2 on the outer list copies the reference, so both rows are the same list object. Use [[0] * 2 for _ in range(2)] for independent rows.
What is printed?
Python · medium
from collections import Counter c = Counter("mississippi") print(c.most_common(2))- [('i', 4), ('s', 4)]
- [('s', 4), ('i', 4)]
- [('i', 4), ('p', 2)]
- [('m', 1), ('i', 4)]
Answer: A. [('i', 4), ('s', 4)]
Explanation: i and s both appear 4 times. Ties keep the order in which elements were first seen, and i (index 1) appears before s (index 2).
What is the time complexity of Dijkstra’s algorithm with a binary heap on a graph with V vertices and E edges?
DSA · hard
- O(V²)
- O((V + E) log V)
- O(V + E)
- O(E · V)
Answer: B. O((V + E) log V)
Explanation: Each vertex is extracted once and each edge may push or decrease a key, each costing O(log V). With a Fibonacci heap it improves to O(E + V log V).
What is printed?
Python · hard
print(all([]), any([]), bool([[]]))- True False True
- False False False
- True True True
- False False True
Answer: A. True False True
Explanation: all() of nothing is True (no element is false), any() of nothing is False. [[]] is a non-empty list, so it is truthy even though its item is empty.
What is printed?
Python · hard
def deco(fn): def wrap(*a): return fn(*a) * 2 return wrap @deco @deco def three(): return 3 print(three())- 6
- 9
- 12
- 3
Answer: C. 12
Explanation: Stacked decorators apply bottom-up: three = deco(deco(three)). The inner wrapper doubles 3 to 6, the outer doubles that to 12.
What is printed?
Python · hard
x = [1, 2, 3] y = x[:] z = x x.append(4) print(len(y), len(z), y is x, z is x)- 3 4 False True
- 4 4 False True
- 3 3 True True
- 4 4 True True
Answer: A. 3 4 False True
Explanation: x[:] makes a shallow copy (a new list), so y keeps 3 items. z is just another name for x.