Practice now without an account

Answer each question before opening its answer. This browser page does not submit, score, or save anything. Closing it clears your unsaved work.

Scope: This fictional, clean-room practice is not certification, a hiring assessment, or evidence of job readiness. Do not use employer or client code, credentials, or data.

Create a free account to save progress and take the scored check

Pull Request Review — 8 questions

How to use this page: choose one answer in your notes or aloud, then open the reveal. For a shuffled, scored attempt with saved feedback, create a free account.

  1. What is the strongest first anchor for reviewing the NeighborLink change?

    1. The acceptance requirements and the behavior they make observable

    2. The author’s seniority

    3. The number of files changed

    4. The reviewer’s preferred coding style

    Show answer and explanation

    Answer: A

    The acceptance requirements and the behavior they make observable

    Answer feedback

    Correct. Requirements provide the standard for deciding whether the proposed behavior is acceptable.

    Why this matters

    Begin with the intended behavior, constraints, and evidence. Then read the diff against that map.

  2. The new log line records the full email and Authorization header. What is the best review decision?

    1. Approve because logs are visible only to developers

    2. Mark it non-blocking and ask for shorter variable names

    3. Block the merge; remove the token and use an approved redacted or non-identifying event record

    4. Copy the token into the review comment so the author can reproduce the issue

    Show answer and explanation

    Answer: C

    Block the merge; remove the token and use an approved redacted or non-identifying event record

    Answer feedback

    Correct. The change violates the explicit confidentiality requirement and may expose a bearer token.

    Why this matters

    Security findings should identify the exposed value, the applicable boundary, and the safe change without repeating the secret.

  3. Which change most directly controls the injection risk in the fictional SELECT and INSERT statements?

    1. Escape apostrophes with a string replacement

    2. Validate that the email contains an @ character

    3. Add a comment saying the email is trusted

    4. Use parameterized statements or the project’s safe data-access API

    Show answer and explanation

    Answer: D

    Use parameterized statements or the project’s safe data-access API

    Answer feedback

    Correct. Bind input as data rather than constructing executable SQL text.

    Why this matters

    Input validation and parameterized access solve different problems. Use both where the contract requires both.

  4. Why is changing <= to < not enough to satisfy the capacity requirement?

    1. The endpoint must return XML instead of JSON

    2. Two requests can read the same remaining place before either write commits

    3. The variable name registration_count is too long

    4. A smaller comparison operator always rejects every request

    Show answer and explanation

    Answer: B

    Two requests can read the same remaining place before either write commits

    Answer feedback

    Correct. The read/check/write sequence must be protected as one database operation.

    Why this matters

    The requirement covers both the boundary value and concurrent behavior. The control must be atomic, not only arithmetically correct.

  5. What is the strongest control for preventing two concurrent duplicate registrations?

    1. A database uniqueness constraint on event and email, with the conflict returned as 409

    2. A second identical SELECT immediately before INSERT

    3. A warning in the user interface

    4. A nightly report of duplicates

    Show answer and explanation

    Answer: A

    A database uniqueness constraint on event and email, with the conflict returned as 409

    Answer feedback

    Correct. The database enforces the invariant at the shared write boundary.

    Why this matters

    Put a critical uniqueness invariant at the authoritative data boundary, then handle the expected conflict explicitly.

  6. The same attendee is submitted twice for the same event. Which response matches the stated fictional contract?

    1. 200 because the endpoint always returns ok

    2. 201 because a duplicate is another successful creation

    3. 500 because every duplicate is an unexpected server failure

    4. 409 because the requested registration conflicts with an existing one

    Show answer and explanation

    Answer: D

    409 because the requested registration conflicts with an existing one

    Answer feedback

    Correct. R5 assigns 409 to a duplicate or full event.

    Why this matters

    Exact response codes are part of the interface. Tests should make each required outcome observable.

  7. Which review comment is most actionable?

    1. This code is bad. Rewrite it.

    2. Blocking — capacity branch: <= admits a write when count equals capacity, and the read/update is not atomic. Please protect the check and write in one database operation and add full-capacity and concurrent-request tests.

    3. Maybe there is a race somewhere?

    4. Use my favorite library instead.

    Show answer and explanation

    Answer: B

    Blocking — capacity branch: <= admits a write when count equals capacity, and the read/update is not atomic. Please protect the check and write in one database operation and add full-capacity and concurrent-request tests.

    Answer feedback

    Correct. It identifies classification, location, evidence, impact, and an observable request.

    Why this matters

    A useful comment makes the decision and the path to resolution understandable without guessing the author’s intent.

  8. What is the most important defect in the supplied test?

    1. It uses the word response instead of result

    2. It does not print the response body

    3. It expects 200 for one happy path and does not exercise authorization, invalid input, duplicates, capacity, concurrency, or sensitive logging

    4. It runs too quickly to be trustworthy

    Show answer and explanation

    Answer: C

    It expects 200 for one happy path and does not exercise authorization, invalid input, duplicates, capacity, concurrency, or sensitive logging

    Answer feedback

    Correct. The test neither matches the contract nor establishes the high-risk branches.

    Why this matters

    Tests should trace to requirements and include the boundary and failure conditions that could invalidate approval.


Want a saved, scored attempt?

Create a free account to save progress and take the scored check

An account lets you take the native Moodle quiz, keep attempts and feedback, and return later. The course remains free.