Coding assessment: debugging & verification: practice drill
10 scenarios, graded as you go, with the exact grading principle for every answer. Start free, no sign-up.
Have a live AI voice or video interview too?
Platforms like Mercor and Alignerr also screen candidates with an automated AI interviewer. Rehearse out loud with a voiced AI interviewer and get an instant scorecard before the real call.
Exact question counts, time limits, and project rubrics vary by platform cohort and qualification tier. Always read the platform's live project instructions carefully.
Sample scenarios
An LLM writes a JavaScript function to sort numbers:
```js function sortNums(arr) { return arr.sort(); } ```
What happens when you call `sortNums([10, 2, 1])`?
Returns `[1, 2, 10]`.
Returns `[1, 10, 2]` because `Array.prototype.sort()` converts elements to strings and sorts lexicographically by default, AND mutates `arr` in-place.
Throws a `TypeError` because numbers need a comparator.
Returns `[10, 2, 1]` unchanged.
Show the answer
B. Returns `[1, 10, 2]` because `Array.prototype.sort()` converts elements to strings and sorts lexicographically by default, AND mutates `arr` in-place.
Without a comparator `(a, b) => a - b`, JS `.sort()` sorts by UTF-16 code units (`'10' < '2'`). It also mutates the input array in-place; use `[...arr].sort((a, b) => a - b)`.
Why must you flag this code in a coding RLHF evaluation?
`list.append()` returns `None` instead of the list.
Mutable default argument bug: the same `tags` list is shared across all calls that omit `tags`.
Python does not allow two parameters with similar names.
`tags` must be a tuple to use `.append()`.
Show the answer
B. Mutable default argument bug: the same `tags` list is shared across all calls that omit `tags`.
Default parameter values in Python are evaluated once at function definition time. Using `tags=[]` causes state to leak between independent calls. The golden fix uses `tags=None` and initializes `if tags is None: tags = []`.
Principle: Python Best Practices: Mutable Default Arguments
An LLM writes a Python deduplication function and claims it is O(n) time:
```python def dedup(items): seen = [] for x in items: if x not in seen: seen.append(x) return seen ```
What is the actual worst-case time complexity?
O(n)
O(n log n)
O(n²), because `x not in seen` performs a linear O(n) scan on a list on every iteration.
O(1)
Show the answer
C. O(n²), because `x not in seen` performs a linear O(n) scan on a list on every iteration.
Checking membership (`x not in seen`) on a `list` is O(n), making the loop O(n²). To preserve order in O(n), track seen items in a `set` alongside the output list (or `list(dict.fromkeys(items))`).
Principle: Big-O Analysis: List Membership vs. Set Lookup
Taking this assessment soon?
Tell us what skills or question formats you want more drills on.