Daily Coding Quiz: Sunday, 8 November 2026
All 10 coding questions with answers and explanations. 0 players took part.
What does len({"a": 1, "b": 2, "a": 3}) return?
Python · easy
- 1
- 2
- 3
- An error
Answer: B. 2
Explanation: Dictionary keys are unique. The second "a" overwrites the first, leaving {"a": 3, "b": 2}.
How do you correctly check for missing values in SQL?
SQL · easy
- WHERE salary = NULL
- WHERE salary IS NULL
- WHERE salary = ''
- WHERE salary == NULL
Answer: B. WHERE salary IS NULL
Explanation: NULL is not equal to anything, not even NULL: salary = NULL is never true. Use IS NULL / IS NOT NULL.
In k-nearest neighbours (k-NN) classification, how is a new point labelled?
Machine Learning · easy
- By the majority label among its k closest training points
- By fitting a line through k points
- By the label of the farthest point
- By averaging all training labels
Answer: A. By the majority label among its k closest training points
Explanation: k-NN stores the training data and votes among the k nearest neighbours (by distance) at prediction time.
What does a higher “temperature” do when sampling from an LLM?
AI & GenAI · easy
- Makes answers more deterministic
- Makes output more random and varied
- Makes the model faster
- Increases the context window
Answer: B. Makes output more random and varied
Explanation: Temperature divides the logits before softmax. Above 1 flattens the distribution (more surprising tokens); near 0 almost always picks the top token.
Which task draws a box around every object and names its class?
Computer Vision · easy
- Image classification
- Object detection
- Semantic segmentation
- Image captioning
Answer: B. Object detection
Explanation: Detection gives a box and label per object (e.g. YOLO). Classification labels the whole image; segmentation labels every pixel.
What is printed?
Python · medium
d = {"a": 1} print(d.get("b", 0), d.setdefault("b", 5), d)- 0 5 {'a': 1, 'b': 5}
- 0 0 {'a': 1}
- None 5 {'a': 1, 'b': 5}
- KeyError
Answer: A. 0 5 {'a': 1, 'b': 5}
Explanation: get returns the default without inserting. setdefault inserts the key with the default when it is missing and returns it.
What is printed?
Python · medium
funcs = [lambda: i for i in range(3)] print([f() for f in funcs])- [0, 1, 2]
- [2, 2, 2]
- [0, 0, 0]
- An error
Answer: B. [2, 2, 2]
Explanation: Closures capture the variable, not its value. By the time the lambdas run, i is 2. Bind it now with lambda i=i: i.
What is printed?
Python · hard
class A: def hi(self): return "A" class B(A): def hi(self): return "B" + super().hi() class C(A): def hi(self): return "C" + super().hi() class D(B, C): pass print(D().hi())- BA
- BCA
- CBA
- BACA
Answer: B. BCA
Explanation: D’s method resolution order is D → B → C → A. super() follows the MRO, not the parent class, so B calls C, which calls A.
In MySQL InnoDB, what is a covering index?
SQL · hard
- An index on every column
- An index that holds every column a query needs, so the table rows never have to be read
- The clustered primary-key index
- An index on a JSON column
Answer: B. An index that holds every column a query needs, so the table rows never have to be read
Explanation: If the query’s WHERE, SELECT and ORDER BY columns are all in the index, InnoDB answers from the index alone. EXPLAIN shows “Using index”.
You tune hyperparameters with cross-validation on the full dataset and report the best CV score as your final result. What is the problem?
Machine Learning · hard
- None
- The score is optimistically biased: you selected the best of many tries on the same folds. Use nested CV or a held-out test set
- Cross-validation can’t tune hyperparameters
- The model will underfit
Answer: B. The score is optimistically biased: you selected the best of many tries on the same folds. Use nested CV or a held-out test set
Explanation: Picking the maximum over many configurations overfits to the validation folds. Nested cross-validation, or a final test set untouched during tuning, gives an honest estimate.