Problem Solving

Problem Solving — Midpoint Micro-Exam

Which statement gives two teammates the same checkable rule to implement?

A community center wants a bicycle loan checker for weekend visitors.

Show the answer and reasoning

Correct answer Approve a visitor bicycle loan only when freeBikes > 0 and the visitor holds a valid photo ID

Option B names the actor, action, and two exact measurable conditions (freeBikes > 0 and valid photo ID); A and C omit the approval rule.

Review this guide — Spot the Missing Rule in a Request
Which classification is completely accurate?

A campus print kiosk receives a student ID and page count, checks the student’s remaining print quota, and returns Approved or Declined.

Show the answer and reasoning

Correct answer Request input: page count · Stored state: remaining quota · Output: Approved or Declined

Page count arrives with the request, remaining quota is stored prior state, and Approved/Declined is the returned decision output.

Review this guide — Separate Request Inputs from Stored State
What are the exact expected outcomes for minutes = 0 and minutes = -5?

A parking meter accepts whole minutes from 0 to 120 inclusive. Policy: values outside 0..120 return INVALID_MINUTES; valid values >= 15 issue a ticket, and 0..14 return TOO_SHORT.

Show the answer and reasoning

Correct answer 0 → TOO_SHORT (valid domain), -5 → INVALID_MINUTES (out of range)

0 is inside the inclusive domain [0, 120] and maps to TOO_SHORT, whereas -5 lies outside the domain and triggers INVALID_MINUTES.

Review this guide — Decide What Happens on Invalid Input
Which item belongs to Screen Design rather than the Core Rule / Contract?

A museum audio-guide desk wants to hand out devices only when stock > 0, limit devices to 1 per ticket, and display the remaining count in bold dark green.

Show the answer and reasoning

Correct answer Display the remaining count in bold dark green

Font weight and color styling are presentation details that do not alter whether a device handover is approved.

Review this guide — Separate the Rule from the Screen Design

Problem Solving — Final Micro-Exam

Which pair cleanly isolates the safety-training rule without confounding variables?

A science lab loans a microscope only when the kit is inspected (inspected = true) AND the student completed safety training (trained = true).

Show the answer and reasoning

Correct answer (inspected=true, trained=true) → true vs. (inspected=true, trained=false) → false

Holding inspected=true constant while toggling trained from true to false isolates the safety-training condition cleanly.

Review this guide — Pair One Accepting and One Declining Example
What sequence of freeLockers values occurs after Request A, Request B, and the key return?

A locker bank starts with freeLockers = 1. Request A arrives and succeeds. Request B arrives immediately after. Then Request A’s student returns their key.

Show the answer and reasoning

Correct answer 0, 0, 1 (Request B is declined and leaves state unchanged)

Request A reduces freeLockers from 1 to 0; Request B is declined so freeLockers stays 0; returning the key restores it to 1.

Review this guide — Record the State Before and After an Action
Which single test case catches a programmer who accidentally wrote age < 12 instead of age <= 12?

A school bus pass is discounted for riders aged 12 or younger (age <= 12).

Show the answer and reasoning

Correct answer age = 12 → expected discounted (true)

Both age < 12 and age <= 12 agree on 11 and 13; only the exact cutoff age = 12 exposes the missing equality sign.

Review this guide — Write a Boundary Example Before Coding
Which step order correctly turns this edge case into an executable acceptance check?

You discover an edge case where a user submits an empty string "" as a room code.

Show the answer and reasoning

Correct answer 1. Name exact input ("") → 2. Declare invalid-input policy → 3. Record pass/fail check in contract

You must name the concrete input and agree on the invalid-input policy before locking the expected pass/fail check.

Review this guide — Turn an Edge Case into a Checkable Rule
What must be added to eliminate ambiguity for a free washer requested at 22:15?

A dorm laundry spec states: "Residents may book a washer whenever one is free" and "Washers are closed after 22:00."

Show the answer and reasoning

Correct answer Explicit precedence stating closing-hours decline overrides machine availability, plus the 22:15 → Decline check

Explicit rule precedence plus a concrete overlap case (22:15 → Decline) resolves the contradiction deterministically.

Review this guide — Spot and Resolve Conflicting Rules

Flowcharts and Logic

Flowcharts and Logic — Midpoint Micro-Exam

Which step order avoids unlocking the locker before checking whether the badge is active?

A locker kiosk unlocks a temporary gym locker using a scanned campus badge.

Show the answer and reasoning

Correct answer 1. Read badge ID → 2. Check badge status → 3. If active, unlock locker; else decline

The kiosk must read the badge and check its status before deciding whether to unlock the locker.

Review this guide — Put the Steps in Order
Which condition and age-18 outcome match this policy?

A museum grants free youth entry to visitors under 18 years old (strictly less than 18).

Show the answer and reasoning

Correct answer age < 18 → age 18 pays regular admission

"Under 18" is a strict upper bound (`age < 18`), so a visitor aged 18 is excluded from free entry.

Review this guide — Choose Between At Least (>=) and More Than (>)
What does the rule evaluate to when `isStaff = true` and `isWindAlert = true`?

An elevator opens on the roof deck only when `isStaff && !isWindAlert`.

Show the answer and reasoning

Correct answer false — `!isWindAlert` becomes false, so AND fails

`!true` evaluates to `false`, and `true && false` evaluates to `false`.

Review this guide — Flip a Condition Clearly with NOT
What happens for `total = 120`, and how should the chain be fixed?

Shipping tiers: `>= 100` → Express Free, `>= 50` → Standard Free, `< 50` → Paid. Someone wrote `if (total >= 50) return "Standard Free"; else if (total >= 100) return "Express Free";`.

Show the answer and reasoning

Correct answer It wrongly returns "Standard Free"; check `total >= 100` first, then `total >= 50`

Because `120 >= 50` matches first, the `>= 100` branch is unreachable unless ordered from highest threshold to lowest.

Review this guide — Order Multi-Branch Thresholds Without Shadowing

Flowcharts and Logic — Final Micro-Exam

Which single combined rule is equivalent when both rejections produce the exact same action?

A clinic intake flowchart first asks "Has appointment?". If Yes, it asks "Arrived on time?". Only Yes → Yes assigns a room; every other path asks the patient to check in at reception.

Show the answer and reasoning

Correct answer hasAppointment && arrivedOnTime

When both nested conditions must be true for the sole success path and all other paths share one rejection action, AND is equivalent.

Review this guide — Choose Between Nested Decisions and Combined AND
What structural flaw does this flowchart have?

A ticket validator checks `if (isExpired) return "Reject";` and has no `else` branch for valid tickets.

Show the answer and reasoning

Correct answer An open-ended branch: when `isExpired` is false, the flow never returns a defined decision

Every possible input path must terminate in an explicit output; the false branch was left unhandled.

Review this guide — Verify Every Path Produces an Output and Ends
How many times does `printOne()` run when `pagesLeft` starts at `0`, and how many times when it starts at `3`?

A print spooler runs `while (pagesLeft > 0) { printOne(); pagesLeft = pagesLeft - 1; }`.

Show the answer and reasoning

Correct answer 0 passes when starting at 0; 3 passes when starting at 3

A pre-test `while (pagesLeft > 0)` loop checks before running: 0 > 0 is immediately false (0 passes), while 3 runs for 3, 2, 1 (3 passes).

Review this guide — Trace a Loop That Runs Zero Times
What happens if "Invoice #42" is NOT in the tray?

A student scans a tray of 5 envelopes looking for "Invoice #42" with `while (remaining > 0)` but forgets to decrement `remaining` inside the loop.

Show the answer and reasoning

Correct answer An infinite loop — `remaining > 0` stays true forever because no state moves toward stopping

Without decrementing `remaining`, a missing target means the stopping condition is never reached.

Review this guide — Spot Why a Loop Never Stops

Programming Foundations

Programming Foundations — Midpoint Micro-Exam

What are the final values of `left` and `right`?

Variables start as `left = "Room A"` and `right = "Room B"`. Code runs `left = right; right = left;`.

Show the answer and reasoning

Correct answer Both become "Room B" because "Room A" was overwritten without a temporary variable

`left = right` immediately overwrites `"Room A"` with `"Room B"`, so `right = left` simply copies `"Room B"` back.

Review this guide — Swap Two Values Without Losing One
What value does `"12" + 1` produce, and how should the checker prevent it?

A form input returns `seats = "12"` as text, and a buggy checker adds `seats + 1` in JavaScript without converting to an integer.

Show the answer and reasoning

Correct answer It produces `"121"` (string concatenation); validate or parse into an integer before math

In JavaScript, `+` with a string concatenates text (`"12" + 1 === "121"`). Explicit integer checks prevent silent type bugs.

Review this guide — Avoid Mixing Numeric Text and Numbers
Which statement treats these three values accurately?

A weather sensor logs three readings: Station 1 reports `0` °C, Station 2 reports `""`, Station 3 has `null` (offline).

Show the answer and reasoning

Correct answer `0` is a valid freezing temperature, `""` is empty text, and `null` means missing data

Zero is a real numeric measurement, an empty string is blank text, and null represents absent data.

Review this guide — Tell Apart Zero, Empty Text, and Missing Data
What should this function return for `[]`, and why is `badges[0]` unsafe without a length check?

A helper counts how many badges in `badges = []` are active by initializing `count = 0` and looping over each item.

Show the answer and reasoning

Correct answer It cleanly returns `0`; reading `badges[0]` directly crashes or returns undefined on an empty list

An empty list causes 0 loop iterations and cleanly returns the initial `count = 0`; direct index `[0]` access fails when length is 0.

Review this guide — Handle an Empty List Without Crashing

Programming Foundations — Final Micro-Exam

What are the filtered list and the passing count?

Scores list is `[45, 70, 60, 88]`. A filter keeps scores `>= 60`, and a counter counts passing scores.

Show the answer and reasoning

Correct answer Filtered list: `[70, 60, 88]` · Count: `3`

Because the threshold is inclusive (`>= 60`), 70, 60, and 88 all qualify in their original order (count = 3).

Review this guide — Collect All Matching Items from a List
Which data structure and lookup pattern fits best?

A campus directory maps 400 room codes (`"B-204"`) to seat counts. Unknown room codes should return `0` seats instead of throwing a lookup error.

Show the answer and reasoning

Correct answer Key-value map with safe default lookup (e.g., `rooms.get(code, 0)` / `rooms[code] ?? 0`)

A map looks up keys directly by room code and a safe default (`0`) prevents crashes on unknown rooms.

Review this guide — Handle a Missing Map Key Safely
Why is Version B much easier to test and reuse across interfaces?

Two teammates wrote `checkPass(score)`. Version A prints `"Pass"` directly to the console and returns nothing. Version B returns boolean `true` or `false`.

Show the answer and reasoning

Correct answer Returning a typed value separates calculation from display so unit tests can assert the return value directly

Returning a boolean lets automated tests and any UI format the result however they need.

Review this guide — Return a Value Instead of Printing It
How do you make `promote` pure and predictable?

Function `promote(waitlist, seats)` calls `waitlist.shift()` inside the function, erasing items from the caller’s original array.

Show the answer and reasoning

Correct answer Build and return a brand-new promoted list without mutating the input `waitlist`

Returning a fresh array leaves caller state intact so calling the function twice with the same inputs produces identical results.

Review this guide — Keep Decision Functions Predictable and Repeatable

From Plan to Code

From Plan to Code — Midpoint Micro-Exam

Which pseudocode order places the guard correctly?

You are writing pseudocode for `canRentBike(freeBikes)` where negative inputs must return `INVALID_BIKES` before checking `freeBikes > 0`.

Show the answer and reasoning

Correct answer IF freeBikes < 0 THEN return ERROR "INVALID_BIKES" · ELSE return freeBikes > 0

Input validation must run before the main return statement so invalid values are caught immediately.

Review this guide — Put an Invalid-Input Guard First in Pseudocode
What does this pseudocode return?

Pseudocode: `SET count = 0; FOR EACH seat IN [true, false, true, true]: IF seat == true THEN count = count + 1; RETURN count`.

Show the answer and reasoning

Correct answer 3

Three items in `[true, false, true, true]` equal `true`, incrementing `count` from 0 to 3.

Review this guide — Write Pseudocode for a Loop and Running Count
Which language mapping matches 1, 2, and 3 in order?

Look at these three return signatures for `canBook(freeSeats)`: 1) `def can_book(free_seats: int) -> bool:` 2) `function canBook(freeSeats)` 3) `func canBook(freeSeats int) bool`

Show the answer and reasoning

Correct answer 1: Python · 2: JavaScript · 3: Go

`def ... -> bool:` is Python, `function name(...)` is JavaScript, and `func name(arg int) bool` is Go.

Review this guide — Run Your First Function in Python
What did running the same boundary input in both languages reveal?

Python returns `False` for `can_book(0)` while JavaScript returns `true` for `canBook(0)`. Both return `true` for `1` and `2`.

Show the answer and reasoning

Correct answer Contract drift: JavaScript likely used `freeSeats >= 0` instead of `freeSeats > 0`

Boundary input `0` immediately exposes an off-by-one `>= 0` vs `> 0` drift between the two ports.

Review this guide — Check the Same Inputs in Two Languages

From Plan to Code — Final Micro-Exam

Which trio uses the valid boolean operators for all three languages?

You need to write the compound rule "seat is free AND not locked" in Python, JavaScript, and Go.

Show the answer and reasoning

Correct answer Python: `is_free and not is_locked` · JS & Go: `isFree && !isLocked`

Python uses lowercase `and`/`or`/`not`, whereas JavaScript and Go use `&&`/`||`/`!`.

Review this guide — Write AND, OR, and NOT Across Python, JS, and Go
What is `i` in `for i := range items`, and how should you iterate values cleanly in Go?

In Go, a learner writes `for i := range items` to sum positive integers in `items = []int{3, -1, 5}`.

Show the answer and reasoning

Correct answer `i` is the index (0, 1, 2); use `for _, value := range items` to read each item directly

In Go, the first variable of `range` is always the index; use `for _, value := range items` to read element values.

Review this guide — Loop Over a Slice and Count Matches in Go
Why does `??` work correctly here while `||` introduces a bug?

A map `seats = {"A": 0}` is queried for key `"A"` in JavaScript using `seats["A"] || -1` versus `seats["A"] ?? -1`.

Show the answer and reasoning

Correct answer `||` treats valid `0` as falsy and returns `-1`; `??` only falls back on `null` or `undefined` and preserves `0`

Nullish coalescing (`??`) preserves valid `0` and `false` values, whereas logical OR (`||`) overwrites them with the fallback.

Review this guide — Check Missing Map Keys in Python, JS, and Go
How should a Python validator guard `free_seats` so passing `True` raises `ValueError("INVALID_FREE_SEATS")` just like JavaScript?

In Python, `isinstance(True, int)` returns `True` because `bool` is a subclass of `int`.

Show the answer and reasoning

Correct answer Check `isinstance(free_seats, bool) or not isinstance(free_seats, int) or free_seats < 0`

Explicitly rejecting `isinstance(x, bool)` before `isinstance(x, int)` stops `True`/`False` from slipping through as `1`/`0`.

Review this guide — Reject Invalid Inputs Explicitly in Python

DevOps-Style Planned Coding with AI

DevOps-Style Planned Coding with AI — Midpoint Micro-Exam

Which prompt is checkable and leaves no ambiguity about invalid-input behavior?

You are briefing an AI coding agent to add a negative-input guard to `canLoanEquipment` in `src/loan.js`.

Show the answer and reasoning

Correct answer Edit only `src/loan.js` and `tests/loan.test.js`: reject empty `itemCode` with `INVALID_LOAN_INPUT`, keep existing tests passing, and run `npm test`

Naming the exact file scope, explicit error code (`INVALID_LOAN_INPUT`), and test command gives the agent a checkable specification.

Review this guide — Tell the Agent How to Handle Invalid Inputs
Which item in the agent’s proposed plan is out-of-scope creep that you should remove before approving?

Task scope: fix the `>= 60` cutoff in `src/quiz.ts` and add a boundary test for `score = 60`.

Show the answer and reasoning

Correct answer Rename all CSS theme variables and reformat 14 unrelated UI components

Renaming CSS variables and reformatting 14 unrelated UI files has nothing to do with the `>= 60` rule and makes diff review harder.

Review this guide — Name What Is Out of Scope Before Editing
Which sequence follows planned AI coding discipline?

Before letting an AI agent edit your repository, you prepare context and review its plan.

Show the answer and reasoning

Correct answer 1. Provide exact rule, target file, and boundary cases → 2. Read the agent’s plan & out-of-scope list → 3. Approve edit

Supplying minimal relevant context and checking the agent’s plan before edits catches scope creep and wrong assumptions early.

Review this guide — Review the Plan Before the Agent Edits
What should you do right now before authorizing edits?

The agent’s plan says: "If `openSeats` is negative, I will clamp it to `0` and return `[]`." Your contract requires returning `INVALID_WAITLIST_INPUT`.

Show the answer and reasoning

Correct answer Correct the hidden assumption in the plan so negative `openSeats` explicitly returns `INVALID_WAITLIST_INPUT`

Fixing a silent clamping assumption in the plan takes seconds and avoids writing code that contradicts the contract.

Review this guide — Catch Hidden Assumptions in an Agent Plan

DevOps-Style Planned Coding with AI — Final Micro-Exam

Which test-first workflow proves the agent actually fixed the bug?

A bug report shows `canBookGroup(4, 0, true)` wrongly returns `true` instead of `INVALID_GROUP_BOOKING`.

Show the answer and reasoning

Correct answer 1. Add test for `(4, 0, true)` → 2. Run test and observe red failure → 3. Add `requestedSeats < 1` guard → 4. Rerun full suite green

Seeing the new test fail red before editing proves the test actually exercises the bug; seeing the full suite turn green afterward proves the fix.

Review this guide — Guide an Agent Starting from a Failing Test
What did your diff review just catch?

An agent reports "All tests pass!" You read the diff: `- assert.throws(() => canBook(-1), /INVALID_FREE_SEATS/); + assert.equal(canBook(-1), false);`

Show the answer and reasoning

Correct answer Silent test weakening: the agent changed the contract assertion instead of fixing the missing negative-input guard

Changing an expected `INVALID_FREE_SEATS` error into `false` weakens the contract test instead of fixing the buggy function.

Review this guide — Spot When a Diff Weakens a Test Instead of Fixing the Bug
What two defects must you ask the agent to fix before accepting?

You asked to update the passing cutoff from `60` to `65` in Python and JavaScript. The diff updates `quiz.py` to `65`, leaves `quiz.js` at `60`, and reformats `README.md`.

Show the answer and reasoning

Correct answer Cross-file contract drift (`quiz.js` still uses 60) and out-of-scope edit (`README.md` formatting)

Both sibling implementations must stay synchronized at `65`, and unrelated `README.md` edits should be reverted out of the patch.

Review this guide — Check for Contract Drift Across Files
Why is Commit X dramatically safer in a team repository?

Compare Commit X ("Fix zero-seat boundary in canBookRoom and add regression test" — 2 files) vs Commit Y ("misc updates" — 19 files mixing bug fix, UI color tweak, and dependency bump).

Show the answer and reasoning

Correct answer It is atomic, explains the exact behavior change, and can be reverted cleanly without undoing unrelated work

Small atomic commits isolate one logical change so teammates can review, audit, or revert it cleanly.

Review this guide — Keep Commits Small Enough to Revert Safely

Testing and Delivery

Testing and Delivery — Midpoint Micro-Exam

Which set covers BOTH the lower and upper boundaries tightly?

A shuttle van holds between `1` and `12` riders inclusive (`1 <= riders <= 12`).

Show the answer and reasoning

Correct answer `0, 1, 2` (lower edge) and `11, 12, 13` (upper edge)

Testing `0, 1, 2` checks the inclusive lower bound `1`, and `11, 12, 13` checks the inclusive upper bound `12`.

Review this guide — Test Both Lower and Upper Capacity Limits
Which two extra cases catch empty-list crashes, single-element off-by-one bugs, and invalid types?

You wrote a list-average helper `countPassing(scores)` with tests only for `[70, 80, 90]`.

Show the answer and reasoning

Correct answer Empty list `[]`, single-item `[60]`, and wrong type `"60"` or negative `[-5]` per policy

Empty lists, single-element lists, and invalid-type/negative cases catch initialization and validation bugs that typical 3-item lists hide.

Review this guide — Test Empty Lists and Single-Item Lists
Which bug report is immediately reproducible and ready to trace?

A teammate sends a bug message in chat about `canCheckoutBook`.

Show the answer and reasoning

Correct answer Input `(isAvailable=true, borrowedCount=3)` · Expected `false` · Actual `true` (failed at `borrowedCount <= 3`)

Naming exact input, expected result, and actual result lets any teammate reproduce the bug in seconds.

Review this guide — Reproduce a Bug with One Input
Since `4 / 5` is exactly `80%`, what bug does this Expected-vs-Actual diff point to?

A test assertion fails with: `Expected: "ELIGIBLE" (string) Actual: "WARNING" (string) Input: checkAttendance(4, 5)`

Show the answer and reasoning

Correct answer Either strict `> 80%` instead of `>= 80%`, or `>= 60%` was checked before `>= 80%`

Both outputs are strings, so it is a threshold/branch-order logic bug at exact 80% (`4/5`).

Review this guide — Diagnose Expected vs. Actual Assertion Failures

Testing and Delivery — Final Micro-Exam

What is the right fix and what should you run immediately afterward?

`scoreQuiz(["A","B","C"], ["A","B","C"])` returned `2` because the loop stopped at `i < key.length - 1`.

Show the answer and reasoning

Correct answer Change to `i < key.length` and rerun ALL fixtures (partial, shifted, empty, full, and unequal-length invalid)

Fixing the stop bound to `i < key.length` checks the final index, and rerunning the full fixture suite confirms no neighbors broke.

Review this guide — Find and Fix an Off-by-One Loop Bug
Should you accept this output as proof that the regression test passed?

After running a test command, the console prints: `Ran 0 tests in 0.001s — OK (exit code 0)`.

Show the answer and reasoning

Correct answer No — 0 tests executed! Fix test discovery/naming until the exact regression test runs and shows a non-zero pass count

Zero tests executed proves nothing even when exit code is 0; real verification requires seeing the targeted checks execute.

Review this guide — Read the Actual Test Output
What is the accurate fix and honest verification report?

Your local suite ran Node.js tests and passed. In CI, the job fails with `Error: Cannot find module "./fixtures.json"` and Go is not installed on the runner.

Show the answer and reasoning

Correct answer Commit the untracked `fixtures.json`, rerun CI, and report Node/Python executed results separately from unexecuted Go

Missing committed files cause CI-only `Cannot find module` errors, and runtimes that did not run must be reported explicitly as unexecuted.

Review this guide — Diagnose a Test That Passes Locally but Fails in CI
Which merge-gate order protects `main` best?

You finished a small bug fix and want to merge it safely to `main`.

Show the answer and reasoning

Correct answer 1. Local tests & build pass → 2. Push & verify green CI → 3. Review diff for scope & assertion integrity → 4. Merge

Local verification, green clean-environment CI, and human diff review together form a reliable merge gate.

Review this guide — Use Passing CI Checks as a Merge Gate

Practice Projects

Practice Projects — Midpoint Micro-Exam

What are the exact outcomes for `(3, 3, true)`, `(3, 4, true)`, and `(3, 0, true)`?

Contract `canBookGroup(freeSeats, requestedSeats, hasPermission)`: valid if `freeSeats >= 0`, `requestedSeats >= 1`, `hasPermission` boolean; returns `hasPermission && requestedSeats <= freeSeats`.

Show the answer and reasoning

Correct answer `true`, `false`, `INVALID_GROUP_BOOKING`

`3 <= 3` fits (`true`), `4 <= 3` exceeds capacity (`false`), and `requestedSeats = 0` violates `>= 1` (`INVALID_GROUP_BOOKING`).

Review this guide — Extend the Booking Checker with Group Size and Invalid Guards
Which single test case catches a buggy implementation using `borrowedCount <= 3`?

Library checkout allows borrowing when `isAvailable === true && borrowedCount < 3` (with `borrowedCount >= 0`).

Show the answer and reasoning

Correct answer `isAvailable = true, borrowedCount = 3` → expected `false`

With `isAvailable = true` and `borrowedCount = 3`, the correct `< 3` rule returns `false` while the buggy `<= 3` rule wrongly returns `true`.

Review this guide — Build a Library Checkout Checker
What do `canLoanEquipment({"OSC-1": 2}, "UNKNOWN", true)` and `canLoanEquipment({"OSC-1": 2}, "", true)` return?

Contract `canLoanEquipment(stockMap, itemCode, hasSafetyClearance)`: empty `itemCode` returns `INVALID_LOAN_INPUT`; missing key defaults safely to `0` stock.

Show the answer and reasoning

Correct answer `false` for `"UNKNOWN"`, and `INVALID_LOAN_INPUT` for `""`

Unknown equipment code defaults safely to `0` stock (`false`), whereas an empty string violates the input contract (`INVALID_LOAN_INPUT`).

Review this guide — Build a Lab Equipment Loan Checker
Which deliverable bundle satisfies all core project evidence checks?

You finished implementing `canLoanEquipment` and want to submit it against the project rubric.

Show the answer and reasoning

Correct answer Plain-language contract, clean pure function, fixture tests (typical, boundary, missing-key, invalid), actual test output, and small explainable diff

Complete project evidence pairs the clear rule and pure code with runnable fixtures, real test output, and a reviewable diff.

Review this guide — Build a Study-Room Booking Checker

Practice Projects — Final Micro-Exam

What is the correct score, and what bug would mistakenly return `3`?

Classroom Quiz Scorer compares `answerKey = ["A", "B", "C"]` against `studentAnswers = ["C", "A", "B"]`.

Show the answer and reasoning

Correct answer Correct score is `0`; checking `answerKey.includes(ans[i])` instead of index equality `answerKey[i] === ans[i]` wrongly returns `3`

Quiz scoring compares answers at matching indexes; `"C"`, `"A"`, `"B"` never match `"A"`, `"B"`, `"C"` at the same position (score 0).

Review this guide — Build a Classroom Quiz Scorer
What does `promoteWaitlist(waitlist, 2)` return, and what happens to `waitlist.length`?

`waitlist = [{name:"Ece", eligible:false}, {name:"Kaan", eligible:true}, {name:"Mina", eligible:true}, {name:"Nuri", eligible:true}]` and `openSeats = 2`.

Show the answer and reasoning

Correct answer Returns `["Kaan", "Mina"]` and leaves original `waitlist.length === 4` untouched

Filtering eligible entries first skips Ece, selects Kaan and Mina (2 seats), and leaves the original 4-item waitlist unmutated.

Review this guide — Build a Workshop Waitlist Promoter
What are the exact outputs for `(3, 5)`, `(0, 0)`, and `(6, 5)`?

Contract `checkAttendance(attended, totalSessions)`: `>= 80%` → `"ELIGIBLE"`, `>= 60%` → `"WARNING"`, `< 60%` → `"INELIGIBLE"`; `totalSessions <= 0` or `attended > totalSessions` → `INVALID_ATTENDANCE`.

Show the answer and reasoning

Correct answer `"WARNING"`, `INVALID_ATTENDANCE`, `INVALID_ATTENDANCE`

`3/5` is exact 60% (`"WARNING"`), `0/0` fails `totalSessions >= 1`, and `6/5` fails `attended <= totalSessions`.

Review this guide — Build a Course Attendance Eligibility Checker
Which porting sequence guarantees behavioral parity with zero silent contract drift?

You are porting your finished JavaScript Attendance Eligibility Checker to Python.

Show the answer and reasoning

Correct answer 1. Freeze shared JSON fixtures → 2. Port guards & branches to Python → 3. Run Python runner on same fixtures → 4. Add both runners to CI

Freezing shared fixtures first, running the second language against those exact cases, and gating both in CI prevents contract drift.

Review this guide — Port a Finished Project to a Second Language with Shared Tests