Answer: During a network partition a system cannot be both available for all clients and strictly consistent. Practical systems choose which clients may wait or see stale/error responses, and they document the consistency model in the happy path as well.

Be technically specific
No hidden chain-of-thought dump

State the mechanism
Give a concrete implication

Prompt: State the CAP tradeoff in operational terms for a partitioned key-value store.

Solution: During a network partition a system cannot be both available for all clients and strictly consistent. Practical systems choose which clients may wait or see stale/error responses, and they document the consistency model in the happy path as well.


Answer: An oracle decides whether a run is correct. Survival only shows that one path did not abort, not that codegen matched the language semantics. Stronger oracles include differential tests against another implementation, round-trip execution, or checking explicit invariants on IR.

Be technically specific
No hidden chain-of-thought dump

State the mechanism
Give a concrete implication

Prompt: What is a test oracle, and why is 'assert not crashed' a weak oracle for a compiler?

Solution: An oracle decides whether a run is correct. Survival only shows that one path did not abort, not that codegen matched the language semantics. Stronger oracles include differential tests against another implementation, round-trip execution, or checking explicit invariants on IR.


Answer: spent=20; remaining=10; cart=laptopsx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 30. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=20; remaining=10; cart=laptopsx1,docksx1.


Answer: spent=24; remaining=7; cart=laptopsx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 31. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=24; remaining=7; cart=laptopsx2.


Answer: spent=32; remaining=0; cart=laptopsx2,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 32. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=32; remaining=0; cart=laptopsx2,docksx1.


Answer: spent=20; remaining=13; cart=laptopsx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 33. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=20; remaining=13; cart=laptopsx1,docksx1.


Answer: spent=32; remaining=2; cart=laptopsx2,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 34. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=32; remaining=2; cart=laptopsx2,docksx1.


Answer: spent=32; remaining=3; cart=laptopsx2,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 35. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=32; remaining=3; cart=laptopsx2,docksx1.


Answer: spent=35; remaining=1; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 36. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=1; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=32; remaining=5; cart=laptopsx2,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 37. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=32; remaining=5; cart=laptopsx2,docksx1.


Answer: spent=36; remaining=2; cart=laptopsx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 38. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=36; remaining=2; cart=laptopsx3.


Answer: spent=35; remaining=4; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 39. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=4; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=40; remaining=0; cart=laptopsx2,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 40. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=40; remaining=0; cart=laptopsx2,docksx2.


Answer: spent=36; remaining=5; cart=laptopsx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 41. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=36; remaining=5; cart=laptopsx3.


Answer: spent=35; remaining=7; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 42. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=7; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=40; remaining=3; cart=laptopsx2,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 43. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=40; remaining=3; cart=laptopsx2,docksx2.


Answer: spent=44; remaining=0; cart=laptopsx3,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 44. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=44; remaining=0; cart=laptopsx3,docksx1.


Answer: spent=35; remaining=10; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 45. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=10; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=40; remaining=6; cart=laptopsx2,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 46. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=40; remaining=6; cart=laptopsx2,docksx2.


Answer: spent=44; remaining=3; cart=laptopsx3,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 47. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=44; remaining=3; cart=laptopsx3,docksx1.


Answer: spent=35; remaining=13; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 48. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=13; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=40; remaining=9; cart=laptopsx2,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 49. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=40; remaining=9; cart=laptopsx2,docksx2.


Answer: spent=44; remaining=6; cart=laptopsx3,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 50. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=44; remaining=6; cart=laptopsx3,docksx1.


Answer: spent=35; remaining=16; cart=laptopsx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 51. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=35; remaining=16; cart=laptopsx1,docksx1,monitorsx1.


Answer: spent=40; remaining=12; cart=laptopsx2,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 52. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=40; remaining=12; cart=laptopsx2,docksx2.


Answer: spent=52; remaining=1; cart=laptopsx3,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 53. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=52; remaining=1; cart=laptopsx3,docksx2.


Answer: spent=52; remaining=2; cart=laptopsx1,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 54. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=52; remaining=2; cart=laptopsx1,cablesx1.


Answer: spent=55; remaining=0; cart=laptopsx2,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 55. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=55; remaining=0; cart=laptopsx2,docksx2,monitorsx1.


Answer: spent=52; remaining=4; cart=laptopsx3,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 56. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=52; remaining=4; cart=laptopsx3,docksx2.


Answer: spent=52; remaining=5; cart=laptopsx1,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 57. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=52; remaining=5; cart=laptopsx1,cablesx1.


Answer: spent=55; remaining=3; cart=laptopsx2,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 58. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=55; remaining=3; cart=laptopsx2,docksx2,monitorsx1.


Answer: spent=52; remaining=7; cart=laptopsx3,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 59. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=52; remaining=7; cart=laptopsx3,docksx2.


Answer: spent=60; remaining=0; cart=laptopsx1,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 60. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=0; cart=laptopsx1,cablesx1,docksx1.


Answer: spent=55; remaining=6; cart=laptopsx2,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 61. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=55; remaining=6; cart=laptopsx2,docksx2,monitorsx1.


Answer: spent=60; remaining=2; cart=laptopsx3,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 62. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=2; cart=laptopsx3,docksx3.


Answer: spent=60; remaining=3; cart=laptopsx1,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 63. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=3; cart=laptopsx1,cablesx1,docksx1.


Answer: spent=64; remaining=0; cart=laptopsx2,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 64. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=64; remaining=0; cart=laptopsx2,cablesx1.


Answer: spent=60; remaining=5; cart=laptopsx3,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 65. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=5; cart=laptopsx3,docksx3.


Answer: spent=60; remaining=6; cart=laptopsx1,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 66. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=6; cart=laptopsx1,cablesx1,docksx1.


Answer: spent=64; remaining=3; cart=laptopsx2,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 67. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=64; remaining=3; cart=laptopsx2,cablesx1.


Answer: spent=60; remaining=8; cart=laptopsx3,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 68. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=8; cart=laptopsx3,docksx3.


Answer: spent=60; remaining=9; cart=laptopsx1,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 69. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=9; cart=laptopsx1,cablesx1,docksx1.


Answer: spent=64; remaining=6; cart=laptopsx2,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 70. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=64; remaining=6; cart=laptopsx2,cablesx1.


Answer: spent=60; remaining=11; cart=laptopsx3,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 71. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=11; cart=laptopsx3,docksx3.


Answer: spent=60; remaining=12; cart=laptopsx1,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 72. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=12; cart=laptopsx1,cablesx1,docksx1.


Answer: spent=72; remaining=1; cart=laptopsx2,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 73. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=72; remaining=1; cart=laptopsx2,cablesx1,docksx1.


Answer: spent=60; remaining=14; cart=laptopsx3,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 74. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=60; remaining=14; cart=laptopsx3,docksx3.


Answer: spent=75; remaining=0; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 75. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=0; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=72; remaining=4; cart=laptopsx2,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 76. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=72; remaining=4; cart=laptopsx2,cablesx1,docksx1.


Answer: spent=76; remaining=1; cart=laptopsx3,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 77. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=76; remaining=1; cart=laptopsx3,cablesx1.


Answer: spent=75; remaining=3; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 78. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=3; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=72; remaining=7; cart=laptopsx2,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 79. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=72; remaining=7; cart=laptopsx2,cablesx1,docksx1.


Answer: spent=76; remaining=4; cart=laptopsx3,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 80. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=76; remaining=4; cart=laptopsx3,cablesx1.


Answer: spent=75; remaining=6; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 81. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=6; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=80; remaining=2; cart=laptopsx2,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 82. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=80; remaining=2; cart=laptopsx2,cablesx1,docksx2.


Answer: spent=76; remaining=7; cart=laptopsx3,cablesx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 83. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=76; remaining=7; cart=laptopsx3,cablesx1.


Answer: spent=75; remaining=9; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 84. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=9; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=80; remaining=5; cart=laptopsx2,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 85. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=80; remaining=5; cart=laptopsx2,cablesx1,docksx2.


Answer: spent=84; remaining=2; cart=laptopsx3,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 86. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=84; remaining=2; cart=laptopsx3,cablesx1,docksx1.


Answer: spent=75; remaining=12; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 87. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=12; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=80; remaining=8; cart=laptopsx2,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 88. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=80; remaining=8; cart=laptopsx2,cablesx1,docksx2.


Answer: spent=84; remaining=5; cart=laptopsx3,cablesx1,docksx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 89. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=84; remaining=5; cart=laptopsx3,cablesx1,docksx1.


Answer: spent=75; remaining=15; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 90. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=15; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=80; remaining=11; cart=laptopsx2,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 91. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=80; remaining=11; cart=laptopsx2,cablesx1,docksx2.


Answer: spent=92; remaining=0; cart=laptopsx3,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 92. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=92; remaining=0; cart=laptopsx3,cablesx1,docksx2.


Answer: spent=75; remaining=18; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 93. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=18; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=80; remaining=14; cart=laptopsx2,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 94. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=80; remaining=14; cart=laptopsx2,cablesx1,docksx2.


Answer: spent=92; remaining=3; cart=laptopsx3,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 95. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=92; remaining=3; cart=laptopsx3,cablesx1,docksx2.


Answer: spent=75; remaining=21; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 96. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=21; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=95; remaining=2; cart=laptopsx2,cablesx1,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 97. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=95; remaining=2; cart=laptopsx2,cablesx1,docksx2,monitorsx1.


Answer: spent=92; remaining=6; cart=laptopsx3,cablesx1,docksx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 98. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=92; remaining=6; cart=laptopsx3,cablesx1,docksx2.


Answer: spent=75; remaining=24; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 99. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=24; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=95; remaining=5; cart=laptopsx2,cablesx1,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 100. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=95; remaining=5; cart=laptopsx2,cablesx1,docksx2,monitorsx1.


Answer: spent=100; remaining=1; cart=laptopsx3,cablesx1,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 101. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=100; remaining=1; cart=laptopsx3,cablesx1,docksx3.


Answer: spent=75; remaining=27; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 102. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=27; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=95; remaining=8; cart=laptopsx2,cablesx1,docksx2,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 103. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=95; remaining=8; cart=laptopsx2,cablesx1,docksx2,monitorsx1.


Answer: spent=100; remaining=4; cart=laptopsx3,cablesx1,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 104. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=100; remaining=4; cart=laptopsx3,cablesx1,docksx3.


Answer: spent=75; remaining=30; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 105. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=30; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=104; remaining=2; cart=laptopsx2,cablesx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 106. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=104; remaining=2; cart=laptopsx2,cablesx2.


Answer: spent=100; remaining=7; cart=laptopsx3,cablesx1,docksx3

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 107. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 3 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=100; remaining=7; cart=laptopsx3,cablesx1,docksx3.


Answer: spent=75; remaining=33; cart=laptopsx1,cablesx1,docksx1,monitorsx1

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 108. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 1 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=75; remaining=33; cart=laptopsx1,cablesx1,docksx1,monitorsx1.


Answer: spent=104; remaining=5; cart=laptopsx2,cablesx2

Do not exceed budget
Per-item cap as stated
Listed order

For each item buy min(cap, remaining//cost)

Prompt: You have a procurement budget of 109. Catalogue (unit cost): laptops=12, cables=40, docks=8, monitors=15. Walk the catalogue in listed order. For each item buy up to 2 units without exceeding the remaining budget. Report spent, remaining, and cart as namexqty comma-separated.

Solution: Greedy catalogue walk yields spent=104; remaining=5; cart=laptopsx2,cablesx2.


Answer: source_type must be unknown, with an explicit unknown_reason. Do not label it synthetic or human-authored without evidence.

Missing fields are not the same as known synthetic origin.

Set source_type to unknown
Record unknown_reason

Prompt: A dataset row has no source URL and no generator name. What must provenance.source_type be, and what else is required?

Solution: source_type must be unknown, with an explicit unknown_reason. Do not label it synthetic or human-authored without evidence.


Answer: Auto-approve only turns on original tasks inspired by public structure. Copying page text would require a separate license review and a crawler that this pipeline does not run.

No crawler copies pages into the release.

State curriculum_use
State verbatim=false

Prompt: Auto-approve enabled a documentation source. Why must verbatim stay false in Open Reason v1?

Solution: Auto-approve only turns on original tasks inspired by public structure. Copying page text would require a separate license review and a crawler that this pipeline does not run.


Answer: No. NC text cannot be relicensed as Apache-2.0. Leave it out of the release or keep the original SPDX on the row; this project does not relicense NC material.

NC forbids commercial reuse of the licensed text.

Generate original tasks instead if policy allows

Prompt: A page is CC BY-NC. Can those sentences be relicensed as Apache-2.0 inside Open Reason?

Solution: No. NC text cannot be relicensed as Apache-2.0. Leave it out of the release or keep the original SPDX on the row; this project does not relicense NC material.


Answer: Only after an independent check actually ran and passed (sandbox, sympy, numeric, or a named constraint checker). Reviews without a checker stay unverified even at tier A.

Do not mark verified because a human liked the answer.

The schema can store a verification object.

Require a check that ran
Require passed=true

Prompt: When is quality.verified allowed to be true?

Solution: Only after an independent check actually ran and passed (sandbox, sympy, numeric, or a named constraint checker). Reviews without a checker stay unverified even at tier A.


Answer: Training on the holdout makes evaluation scores meaningless. Open Reason's benchmark command fails if ids overlap.

Both are generated by related pipelines.

Keep disjoint ids
Scan overlap before claiming eval

Prompt: Why must benchmarks/items.jsonl stay out of data/release training JSONL?

Solution: Training on the holdout makes evaluation scores meaningless. Open Reason's benchmark command fails if ids overlap.


Answer: GET is safe and idempotent in HTTP semantics, so a retry should not create a new resource. POST create is not idempotent unless the API adds keys or uses PUT to a known URL.

Timeouts do not tell you whether the server applied the request.

Recall GET safety/idempotence
Contrast with POST create

Prompt: Why can a GET be retried after a timeout more safely than a POST that created a row?

Solution: GET is safe and idempotent in HTTP semantics, so a retry should not create a new resource. POST create is not idempotent unless the API adds keys or uses PUT to a known URL.


Answer: Each index slows writes and uses space. Columns that match most rows will not use the index anyway. Index predicates you actually filter or join on, after measuring.

Avoid vendor-specific lore as the only point.

Explain write amplification
Explain low-selectivity scans

Prompt: A product manager asks for an index on every column 'to make the database fast'. What do you teach them?

Solution: Each index slows writes and uses space. Columns that match most rows will not use the index anyway. Index predicates you actually filter or join on, after measuring.


Answer: Many decimal amounts cannot be represented exactly, so rounding accumulates. Store integer minor units or a decimal type with a documented scale.

Do not claim all floats are unusable for science.

Decimals like 0.1 are not exact in binary floating point.

State representation error
Name integers or decimal types

Prompt: Why should a ledger not store currency as IEEE-754 binary float?

Solution: Many decimal amounts cannot be represented exactly, so rounding accumulates. Store integer minor units or a decimal type with a documented scale.


Answer: b still refers to [1, 2]. Rebinding a does not mutate or rebind b.

Do not treat assignment as always copying.

Identify the objects
Track which names are rebound
State b's referent

Prompt: A learner writes `a = [1, 2]; b = a; a = [3]`. Explain whether `b` changes, using name-binding rather than a box metaphor.

Solution: `a = [1, 2]` binds the name `a` to a list object. `b = a` binds `b` to that same object. `a = [3]` creates a new list and rebinds only `a`. `b` still refers to `[1, 2]`.


Answer: [0, 1, 2, 3]

Recall range(n)
List the integers
Explain the missing endpoint

Prompt: What does `list(range(4))` evaluate to, and why is 4 missing?

Solution: range(n) is a half-open interval [0, n). The endpoint n is excluded, matching valid indices of a length-n sequence.


Answer: The default list is created once at definition time. Use None and create a new list in the body.

Repair must keep the convenient default of an empty list per call.

The unexpected sharing happens across calls with no explicit bucket.

Identify the shared object
Explain definition-time evaluation
State the None pattern

Prompt: A function is defined as `def collect(item, bucket=[]): bucket.append(item); return bucket`. A second call with a new item returns a list containing both items. Diagnose the defect and describe the standard repair.

Solution: Default argument objects are evaluated once. The same list is reused and mutated. Write `def collect(item, bucket=None):` and `if bucket is None: bucket = []`.


Answer: Collisions concentrate keys in one bucket, so lookup walks a chain. Mitigations include randomized hash seeds and treeified buckets.

Stay at data-structure behaviour, not a CVE writeup.

Average-case bounds hide adversarial or highly skewed keys.

State the average-case assumption
Describe collision chains
Name a mitigation

Prompt: Why can a hash table that is O(1) average-case become linear in a single lookup, and name one mitigation used in production runtimes?

Solution: Average-case O(1) assumes a bounded load factor and well-spread hashes. If many keys collide, a bucket degrades to a list (or similar) and that lookup is O(n). CPython randomizes hash seeds and treeifies large colliding dict buckets.


Answer: 14

Do not insert extra parentheses that change meaning.

Apply precedence
Compute the product
Add

Prompt: Evaluate 2 + 3 * 4 using standard arithmetic precedence.

Solution: Multiplication binds first: 3 * 4 = 12, then 2 + 12 = 14.


Answer: -3

Isolate x
Simplify
Check by substitution

Prompt: Solve for x: x + 5 = 2.

Solution: Subtract 5 from both sides: x = 2 - 5 = -3.


Answer: 1

f(0) is undefined.
Nearby values approach 1.

Recognize the indeterminate form
Recall or compute the standard limit
State 1

Prompt: Compute lim_{x -> 0} (sin x)/x. Direct substitution is undefined; still give the limit.

Solution: The two-sided limit is 1. A 0/0 form at a point does not by itself imply the limit is missing.


Answer: It must be testable and potentially falsifiable by observation or experiment.

Do not claim experiments prove hypotheses in the mathematical sense.

Slogans that cannot be tested are not scientific hypotheses.

Define testability
Mention falsifiability
Mention controls

Prompt: What makes a scientific hypothesis different from an untestable slogan?

Solution: A hypothesis is a claim that could fail a well-designed test. Experiments can disconfirm it; they do not provide mathematical proof. Controls and replication matter.


Answer: 4

Assume a particle model and constant mass.

Net force and mass are given in SI units.

Prompt: A net force of 12 N acts on a 3 kg mass. What is the acceleration magnitude in m/s^2?

Solution: Newton's second law: a = F/m = 12/3 = 4 m/s^2.


Answer: b is [1, 2, 3] because a and b referred to the same list. append mutated that object; it did not rebind b.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: After a = [1, 2]; b = a; a.append(3), what is b and why?

Solution: Misconception: A variable is a box that stores a copy of an object forever. Why it is wrong: In Python a name is a binding to an object. Assignment rebinds the name; mutable objects can still change through other names. Correct: Names refer to objects. Assignment of one name to another makes both names refer to the same object. Rebinding one name later does not rebind the other.


Answer: Assignment cannot appear in that expression position; comparison uses two equals signs.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Why does if n = 1: fail to parse in Python?

Solution: Misconception: if x = 0 is a valid test that checks whether x equals zero. Why it is wrong: In Python a single equals sign is assignment. Equality is written with two equals signs. The assignment form is a SyntaxError. Correct: Use a comparison, not assignment, in a conditional test.


Answer: [0, 1, 2]

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: What values does list(range(3)) produce?

Solution: Misconception: range(n) yields n, so a loop over range(len(xs)) includes the last index twice. Why it is wrong: range(n) yields 0 through n-1, which is exactly the valid indices of a length-n sequence. Correct: Half-open intervals [0, n) match zero-based indexing. The last index is n - 1.


Answer: The same default list is mutated across calls because it is created once at definition time.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Why can a function with a default empty list return [1, 1] on a second call that appends 1?

Solution: Misconception: A default argument list is created fresh on every call. Why it is wrong: Default argument objects are created once, when the function is defined, and reused. Correct: Use None as the default and create a new list inside the function body.


Answer: [[0, 1]] because the inner list was shared.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: After a = [[0]]; b = a[:]; b[0].append(1), what is a?

Solution: Misconception: Slicing a list always deep-copies nested objects. Why it is wrong: A slice copies the top-level list only. Nested mutables remain shared. Correct: A slice is a shallow copy. Nested lists still alias unless copied recursively.


Answer: 14

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Evaluate 2 + 3 * 4.

Solution: Misconception: Addition is always done before multiplication, left to right. Why it is wrong: Multiplication and division bind more tightly than addition and subtraction. Correct: Evaluate 2 + 3 * 4 as 2 + 12 = 14, not (2 + 3) * 4.


Answer: -3

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Solve x + 5 = 2.

Solution: Misconception: Moving a term across an equals sign never changes its sign. Why it is wrong: Adding the additive inverse is required; the sign of the moved term flips. Correct: From x + 3 = 7, subtract 3 from both sides to get x = 4.


Answer: No. The two-sided limit is 1 even though direct substitution is undefined.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Does lim x->0 of (sin x)/x fail to exist because the expression is 0/0 at 0?

Solution: Misconception: If substituting x=a into f(x) is undefined, the limit cannot exist. Why it is wrong: A limit describes nearby values. A hole or removable discontinuity can still have a finite limit. Correct: Algebraic simplification or a two-sided check can show the limit exists even if f(a) is undefined.


Answer: It must be testable and potentially falsifiable by observation or experiment.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: What would make a hypothesis scientific rather than a slogan?

Solution: Misconception: A hypothesis is an uneducated guess and experiments exist to prove it true. Why it is wrong: A hypothesis is a testable claim. Experiments can falsify it; they do not prove it in the mathematical sense. Correct: Design a test that could fail, collect data, and update confidence. Replication and controls matter.


Answer: It swallows unexpected errors and control-flow exceptions; catch a specific type instead.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Why is a bare except: considered harmful in Python?

Solution: Misconception: except: is the safest way to keep a program running. Why it is wrong: A bare except catches SystemExit and KeyboardInterrupt and hides unexpected bugs. Correct: Catch the specific exception you can handle. Let the rest propagate.


Answer: Theta(n^2) if work() is constant time.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: What is the time complexity of for i in range(n): for j in range(n): work()?

Solution: Misconception: Two nested loops over n items are always O(n) because each loop is simple. Why it is wrong: Each of n outer iterations does n inner iterations, which is Theta(n^2) work. Correct: Multiply independent nested iteration counts unless the inner bound shrinks.


Answer: It builds a list of None values as a side effect of printing. A for-loop states the intent.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Why is `[print(x) for x in xs]` a poor pattern?

Solution: Misconception: A list comprehension is the right place to call functions for their side effects. Why it is wrong: Comprehensions exist to build a collection. Side-effecting inside them hides control flow and still allocates a list. Correct: Use a for-loop for actions. Use a comprehension when you need the resulting sequence.


Answer: It is 'inner', not the original function name.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: After decorating without wraps, what is f.__name__ if the wrapper is named inner?

Solution: Misconception: A decorator that returns an inner function automatically copies the original function's name and docstring. Why it is wrong: The inner function has its own __name__ and __doc__ unless you apply functools.wraps. Correct: functools.wraps(func) updates the wrapper's metadata so tools and tests still see the original identity.


Answer: No. CPython will return 'a' unless you add a runtime check.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Does `def f(x: int) -> int: return x` raise TypeError on f('a')?

Solution: Misconception: A type hint like `def f(x: int)` makes Python reject a str argument at runtime. Why it is wrong: Annotations are not enforced by CPython. They are metadata for checkers and readers. Correct: Use a type checker (or an explicit isinstance guard) if you need a runtime check.


Answer: BFS lists all leaves at distance 1 before going deeper; DFS may fully explore one spoke before another.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: On a star graph, why does BFS from the center differ from DFS?

Solution: Misconception: BFS and DFS always visit nodes in the same order on an undirected graph. Why it is wrong: BFS explores by distance from the start. DFS dives along one path first. Orders differ unless the graph is a path. Correct: Choose BFS for unweighted shortest paths. Choose DFS for connectivity, finishing times, or cycle checks.


Answer: The mean is 26.5, dominated by 100. The median is 2.5 and describes the typical small values.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: For values 1, 2, 3, 100, why might you prefer the median?

Solution: Misconception: The mean is always the best one-number summary of a numeric list. Why it is wrong: A single extreme value can drag the mean. The median is resistant to that skew. Correct: Report mean when the distribution is roughly symmetric; report median (and maybe IQR) when outliers matter.


Answer: Not net heat, once they are in thermal equilibrium. Heat flow requires a temperature difference.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Can two objects at the same temperature exchange heat?

Solution: Misconception: Heat and temperature are two names for the same quantity. Why it is wrong: Temperature is an intensive state variable. Heat is energy transferred because of a temperature difference. Correct: A large lake and a cup of tea can share a temperature while storing very different amounts of thermal energy.


Answer: It receives 3 asynchronously and yields 4. The original work is not rerun.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: If a Promise is already fulfilled with 3, what does a later .then(x => x+1) receive?

Solution: Misconception: Calling .then on a Promise starts the async work a second time. Why it is wrong: A Promise represents one eventual result. Additional then-handlers observe that same settlement. Correct: The executor runs once. later .then calls receive the already-resolved or already-rejected value.


Answer: The predicate is on created_at. An email index does not order or filter that column.

Correct the misconception; do not invent a new error.

Name the false belief
Explain the mechanism
State the correction

Prompt: Why might CREATE INDEX on users.email not help WHERE users.created_at > '2024-01-01'?

Solution: Misconception: An index on column a also speeds WHERE b = 1 even if a is never mentioned. Why it is wrong: A B-tree on a cannot locate rows by b. The planner still needs a scan unless another index matches the predicate. Correct: Index usefulness depends on matching predicates, join keys, and selectivity—not on 'having some index'.


Answer: 8

Apply the definition
Compute
Record the number

Prompt: What is 17 - 9?


Answer: 42

Apply the definition
Compute
Record the number

Prompt: What is 6 × 7?


Answer: 5

Apply the definition
Compute
Record the number

Prompt: Solve 3x - 6 = 9. What is x?

Solution: 3x=15, x=5.


Answer: 40

Apply the definition
Compute
Record the number

Prompt: A rectangle is 5 by 8. What is the area?


Answer: 1/6

Apply the definition
Compute
Record the number

Prompt: A fair six-sided die. P(rolling a 5) as a reduced fraction a/b. Report a/b.

Solution: One favorable face of six.


Answer: 5

Apply the definition
Compute
Record the number

Prompt: Mean of 2, 4, 6, 8?


Answer: 5

Apply the definition
Compute
Record the number

Prompt: Two 10 ohm resistors in parallel. Equivalent resistance in ohms?

Solution: 1/R=1/10+1/10; R=5.


Answer: 4

Apply the definition
Compute
Record the number

Prompt: A wave travels 12 m in 3 s. Speed in m/s?


Answer: 24

Apply the definition
Compute
Record the number

Prompt: How many grams in 2 mol of a 12 g/mol element?

Solution: m=nM=24 g.


Answer: 60

Apply the definition
Compute
Record the number

Prompt: mgh with m=2 kg, g=10 m/s2, h=3 m. Potential energy in J?

Solution: E=60 J.


Answer: 15

Apply the definition
Compute
Record the number

Prompt: A loop runs n=5 times, each time doing 3 constant steps. How many steps?


Answer: 6

Apply the definition
Compute
Record the number

Prompt: How many 2-element subsets of {a,b,c,d}?


Answer: 11

Apply the definition
Compute
Record the number

Prompt: Dot product of (1,2) and (3,4)?


Answer: 1

Apply the definition
Compute
Record the number

Prompt: What is 29 mod 7?


Answer: 0.25

Apply the definition
Compute
Record the number

Prompt: Aa × Aa, P(aa) as a decimal 0.25 or fraction 1/4. Report 0.25.

Solution: One of four Punnett cells.


Answer: 16

Apply the definition
Compute
Record the number

Prompt: Arithmetic sequence 4, 7, 10. What is the 5th term?

Solution: a_n=4+3(n-1); n=5 gives 16.


Answer: -2

Apply the definition
Compute
Record the number

Prompt: Magnification m=-v/u with v=10, u=5 (same units). What is m?


Answer: 10

Apply the definition
Compute
Record the number

Prompt: Convert 10 °C of temperature change to kelvin difference.

Solution: ΔT in K equals ΔT in °C.


Answer: Multiplication binds more tightly than addition, matching ordinary arithmetic.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does `3 + 2 * 4` evaluate to 11 in Python rather than 20?

Solution: * and / are tighter than + and -. Parentheses override. 2*4=8, then 3+8=11.


Answer: 512; exponentiation associates to the right, so 2**(3**2).

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the value of `2 ** 3 ** 2` in Python, and which way does `**` associate?

Solution: 3**2 is 9, then 2**9 is 512. Left-associative would have been (2**3)**2 = 64.


Answer: `if x:` tests truthiness. `if x is True:` tests identity with the boolean True.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the difference between `if x:` and `if x is True:` when x might be 1 or []?

Solution: 1 is truthy but is not True. [] is falsy. Use `is True` only when you mean the boolean singleton.


Answer: Single `=` is assignment and is a SyntaxError there. Use `if n == 0:`.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A script uses `if n = 0:` to test a counter. Why does it fail, and what should it be?

Solution: Comparisons use ==. Assignment is a statement, not a boolean test, in that position.


Answer: The instance is passed implicitly on the call; `self` names that instance inside the method.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does `self` appear as the first parameter of an instance method?

Solution: obj.method(x) is type(obj).method(obj, x). The first parameter is the instance, by convention named self.


Answer: Both see the append unless the instance rebound the name to a new object.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What happens if two instances share a class variable list and one appends to it?

Solution: Class attributes are shared. Mutable class attributes alias across instances. Use instance attributes created in __init__ for per-object state.


Answer: Raise when the caller passed something illegal and must notice. Return None only if absence is a normal outcome.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: When should a function raise ValueError versus returning None?

Solution: Exceptions make the failure path visible. Silent None hides bugs at the next dereference.


Answer: It hides bugs and can swallow KeyboardInterrupt subclasses of Exception in some paths. Catch the specific parse error, log, and re-raise unexpected types.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A parser wraps a whole file in `except Exception: pass`. Name two harms and a tighter pattern.

Solution: Prefer `except json.JSONDecodeError`. Never use a bare except. Avoid swallowing Exception at process boundaries without logging.


Answer: Import sets __name__ to the module name, so the guard skips CLI side effects. Direct execution sets it to '__main__'.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does `if __name__ == '__main__':` guard a script's CLI?

Solution: Libraries should be importable without launching the program. The guard separates library functions from the entry point.


Answer: A list is an iterable that mints a fresh iterator. A generator is the iterator and is exhausted.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can you iterate a list twice but not consume a generator twice?

Solution: iter(list) starts over. A generator's next() advances hidden state until StopIteration.


Answer: An assertion fails the test automatically when the condition is false; a print requires a human to notice.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What makes an assertion in a unit test different from a print of the result?

Solution: Tests must be machine-checkable. assertEqual documents the expected value and fails closed.


Answer: Later tests see leftover state (order dependence). Isolate fixtures: copy, use setUp/tearDown, or construct fresh objects per test.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A test mutates a shared module-level list in setUp and never restores it. What goes wrong, and how do you fix it?

Solution: Shared mutable fixtures create flakes. Each test should own its data.


Answer: The algorithm discards a half based on order. Without sorted order those discards are unjustified.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is binary search incorrect on an unsorted array even if it sometimes finds the key?

Solution: Correctness of binary search is a loop invariant on a sorted range, not a lucky hit.


Answer: Theta(n^2)

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A nested loop runs i from 1..n and j from 1..i. What is Theta of the inner-body executions?

Solution: Sum_{i=1..n} i = n(n+1)/2 which is Theta(n^2).


Answer: Big-O is an upper bound. A quadratic function is also O(n^3).

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is O(n^2) not a contradiction of O(n^3) for the same function?

Solution: f(n)=n^2 is O(n^2) and O(n^3). Theta(n^2) is the tight characterization.


Answer: It recurses until the call stack overflows (or hits the recursion limit).

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A factorial function calls factorial(n) without a base case for n==0. What happens for factorial(3)?

Solution: Every recursive definition needs a base case that returns without another call. 0! is 1.


Answer: It recomputes the same subproblems in two branches, forming an exponential call tree.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can a naive recursive Fibonacci be exponential time?

Solution: T(n)=T(n-1)+T(n-2)+O(1) is Theta(phi^n). Memoization or iteration makes it linear.


Answer: INNER JOIN requires a match in both tables. LEFT JOIN keeps all left rows and nulls the right side when unmatched.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does INNER JOIN drop customers with no orders while LEFT JOIN can keep them?

Solution: Choose INNER when you only want matches. Choose LEFT when absence is information.


Answer: name is not functionally determined by dept, so SQL rejects an ungrouped non-aggregated column.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: In `SELECT dept, COUNT(*) FROM emp GROUP BY dept`, why is `SELECT name` illegal without aggregation or grouping name?

Solution: GROUP BY dept yields one row per department. A per-employee column is not defined on that row.


Answer: 401 means unauthenticated (missing/bad credentials). 403 means authenticated but not allowed.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the difference between HTTP 401 and 403?

Solution: 401 invites supplying credentials. 403 says this principal may not access the resource.


Answer: Revert adds a new commit that undoes a change. Hard reset moves history others still have.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is `git revert` safer than `git reset --hard` on a branch others already pulled?

Solution: Shared branches should grow with new commits, not rewrite published history.


Answer: A closure retains the lexical environment where it was created, not a snapshot of the caller's stack frame after return.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: In JavaScript, why does a function returned from another function still see the outer variable?

Solution: The inner function closes over bindings. Those bindings live as long as the function value is reachable.


Answer: `var` is function-scoped so all callbacks share one i, which is 3 after the loop. Use let, or bind i in a factory.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A loop `for (var i=0;i<3;i++){ setTimeout(()=>console.log(i),0) }` prints 3 three times. Why, and how do you log 0,1,2?

Solution: let creates a fresh binding per iteration. var does not.


Answer: Ownership transferred. Using the old name would be a use-after-move, which Rust rejects.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does moving a String into a function make the original binding unusable afterward?

Solution: Each value has one owner. Move ends the previous owner's access unless the type is Copy.


Answer: Close means no more sends; further sends are programmer errors. Receives drain then produce zero values so range can stop.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is sending on a closed Go channel a panic while receiving after close yields zeros?

Solution: Only the sender should close. Use the two-value receive to detect closure.


Answer: A function assigns one output per input. A vertical line gives many y for one x.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is a vertical line not the graph of a function y=f(x)?

Solution: The vertical-line test is the unique-output rule in the plane.


Answer: 5

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A right triangle has legs 3 and 4. What is the hypotenuse?

Solution: Pythagoras: sqrt(9+16)=sqrt(25)=5.


Answer: 100*pi

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A circle has radius 10. What is its area in terms of pi?

Solution: A=pi r^2 = pi*100.


Answer: 1

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is sin(pi/2) in radians?

Solution: pi/2 radians is 90 degrees; sine of a right angle is 1.


Answer: 10

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: How many 3-element subsets does a 5-element set have?


Answer: 1/2

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A fair coin is flipped twice. What is P(exactly one head)?

Solution: Outcomes HH,HT,TH,TT equally likely. Exactly one head: HT, TH. 2/4=1/2.


Answer: 6

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the determinant of the 2x2 matrix [[2, 0], [0, 3]]?

Solution: ad-bc = 2*3-0*0=6.


Answer: 2

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is 17 mod 5?


Answer: 9

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A 2 kg mass moves at 3 m/s. What is its kinetic energy in joules?

Solution: KE=1/2 m v^2 = 0.5*2*9=9 J.


Answer: 4

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A 12 V battery drives 3 A through a resistor. What is the resistance in ohms?

Solution: V=IR so R=V/I=12/3=4 ohm.


Answer: 4

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Water is H2O. How many moles of hydrogen atoms are in 2 moles of water?

Solution: Each water molecule has 2 H atoms, so 2 mol water contains 4 mol H atoms.


Answer: 2

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A wave has speed 10 m/s and frequency 5 Hz. What is the wavelength in meters?

Solution: v=f lambda so lambda=v/f=10/5=2 m.


Answer: Without untreated plants you cannot separate fertilizer from other growth factors.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is a control group needed when testing whether a fertilizer increases plant height?

Solution: A control holds other variables and shows the baseline. The difference is the evidence, not the treated height alone.


Answer: Lists are mutable and unhashable. Use a tuple of immutables, or freeze the data.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is a list a poor choice as a dict key, and what should you use instead?

Solution: Hash tables require a stable hash. Mutating a key would lose the bucket.


Answer: Indexing is extra machinery and off-by-one prone. Iterating values states the intent.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is `for i in range(len(xs)):` often worse than `for x in xs:` when you only need values?

Solution: Use enumerate if you need index and value. Direct iteration is the default.


Answer: Namespace packages allow import without __init__.py. It fails if another pack on sys.path is a regular package that hides the namespace, or if the directory is not on sys.path.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A package directory has foo.py but no __init__.py on Python 3.3+. Why can `import pack.foo` still work, and when would it fail?

Solution: PEP 420 namespace packages. Explicit __init__.py still makes a regular package. Path order decides which pack wins.


Answer: No. The iterator was exhausted by the first list() call. A second pass needs a new iterator.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Code does `it = iter(xs); list(it); list(it)` and the second list is empty. Is that a bug in list()?

Solution: list(it) consumes it. Call iter(xs) again, or keep the original sequence.


Answer: Full sort is Theta(n log n). A bounded heap is O(n log k), which is smaller when k << n.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: You need the k smallest elements of n numbers, k much smaller than n. Why is a size-k heap often better than fully sorting?

Solution: Each of n insertions/evictions costs O(log k) on a heap of size k. Sorting pays for order you will discard.


Answer: The first POST may have succeeded, so a retry can create a duplicate. Idempotent methods or client-generated idempotency keys make retries safe.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A client retries a POST that created a resource after a timeout with no response. What can go wrong, and what property would make the retry safe?

Solution: Timeouts are not failures. POST is not idempotent by default. PUT to a known URL or an Idempotency-Key header addresses duplicate creates.


Answer: Git only sees overlapping text hunks. It cannot tell which behaviour is intended. A human must combine or choose the correct function body and test it.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Two people edited the same function on different branches. A merge stops with conflict markers. What does Git not know, and what must a human decide?

Solution: Conflict markers are not a compiler. Resolve, remove markers, and run tests before committing the merge.


Answer: Use-after-move. Clone if you need two owned Strings, or print before moving, or borrow with &s.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: This snippet fails to compile: `let s = String::from("hi"); let t = s; println!("{}", s);`. What is the error class, and how do you print both?

Solution: s was moved into t. Clone costs an allocation. Borrowing lets both names observe the same value without a second owner.


Answer: The send blocks forever if nobody receives; when main returns the process exits and the work is lost. Wait with a receive, WaitGroup, or a done channel.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A goroutine sends on an unbuffered channel and the main function returns without receiving. What happens to that send, and how do you wait correctly?

Solution: Unbuffered send synchronizes with a receive. Exiting main does not drain other goroutines.


Answer: 19

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: f(x)=2x+1 and g(x)=x^2. What is (f ∘ g)(3)?

Solution: g(3)=9, then f(9)=19.


Answer: Opposite is a side of the triangle, so it cannot exceed the hypotenuse. Their ratio is at most 1.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why must sine of an angle in a right triangle be at most 1?

Solution: sin = opposite/hypotenuse. Sides are positive and opposite ≤ hypotenuse.


Answer: Each element is independently in or out, giving 2 choices per element, so 2^n subsets.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is the number of subsets of an n-element set 2^n, including the empty set?

Solution: The empty set is the all-out choice. The full set is the all-in choice.


Answer: The intersection would be counted twice. Use P(A)+P(B)-P(A and B).

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can you not add P(A) and P(B) to get P(A or B) when A and B can both happen?

Solution: Inclusion-exclusion. Independent events still have a nonempty intersection in general.


Answer: Determinant 0 means the columns are linearly dependent, so the map collapses a line to a point and is not injective.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does a 2x2 matrix with determinant 0 fail to have an inverse?

Solution: Invertible linear maps are bijective. A collapsed direction cannot be undone.


Answer: Each remainder is a strictly smaller nonnegative integer, so the sequence of remainders cannot descend forever.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does Euclid's algorithm terminate when computing gcd(a,b) for positive integers?

Solution: Well-ordering of nonnegative integers. gcd(a,b)=gcd(b, a mod b) preserves the gcd.


Answer: KE is (1/2)mv^2, a square. Potential energy is defined up to an additive constant, so the zero point is a convention.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can kinetic energy never be negative in classical mechanics while gravitational potential can be set negative?

Solution: Speed squared is nonnegative. You may choose PE=0 at infinity, making bound orbits negative.


Answer: The balanced equation requires a fixed mole ratio. When one reactant is used up, leftover excess cannot form more product.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can a limiting reactant stop a reaction even if the other reactant is still present?

Solution: Stoichiometry is a ratio, not 'mix until gone'. Compute moles and compare to coefficients.


Answer: Wavelength halves because v=fλ with v constant.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: If you double frequency while holding wave speed fixed, what happens to wavelength, and why?

Solution: λ=v/f. Doubling f halves λ.


Answer: Membership in a list is linear, so the loop can be quadratic. A set gives average-case O(1) membership.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Code does `seen = [];` then `if x not in seen: seen.append(x)` inside a hot loop of 10^6 items. What is the complexity problem, and what structure fixes membership?

Solution: Use a set for 'have I seen this hashable x'. Lists preserve order if you also need insertion order; dict/set already do in modern CPython.


Answer: A possible infinite loop: i may never change. Increment in a path that always runs, or add a termination condition that does not depend on the skipped branch.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A while loop increments i only inside an `if` that sometimes fails, and i starts at 0. What class of bug is this, and what is the usual repair?

Solution: Loop variables must progress. Put i += 1 outside the failing if, or restructure.


Answer: y is 4. Integers are immutable; x was rebound, y was not.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: After `x = 4; y = x; x = 5`, what is y, and did y change because x changed?

Solution: Rebinding x does not follow other names. y still refers to 4.


Answer: You cannot add numerators and denominators separately. Common denominator 6 gives 3/6+2/6=5/6.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is 1/2 + 1/3 not 2/5?

Solution: Fractions are ratios. 2/5 would be a different ratio, not the sum of halves and thirds.


Answer: 3*x**2

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the derivative of x^3 with respect to x?

Solution: Power rule: n x^{n-1}. Here n=3.


Answer: Newton's first law: zero net force means constant velocity, which may be nonzero.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: If net force is zero, why can an object still be moving?

Solution: Force changes velocity. Zero net force means no acceleration, not necessarily rest.


Answer: The list comprehension materializes every result immediately. The generator yields values lazily and can be iterated only once.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is the difference between `[x*x for x in xs if x>0]` and a generator expression `(x*x for x in xs if x>0)`?

Solution: Use the list when you need len, reuse, or random access. Use the generator for streaming large sequences.


Answer: [0, 2, 4]

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What list does `[n for n in range(6) if n % 2 == 0]` produce?

Solution: range(6) is 0..5. The filter keeps evens.


Answer: It replaces g with the result of f(g). f must return a callable (usually a wrapper).

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What does `@f` above `def g():` actually do at definition time?

Solution: `def g` binds the original function, then `g = f(g)` runs. That is why argumentless decorators are callables that take a function.


Answer: The wrapper overwrote __name__. Apply @functools.wraps(func) on the inner function.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A timing decorator's wrapper is named `inner` and tests assert `fn.__name__ == 'compute'`. Why do they fail, and what one-line fix is conventional?

Solution: wraps copies __name__, __doc__, and __module__ from the wrapped function.


Answer: __exit__ runs during stack unwind, so close happens on both success and exception paths.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does `with open(path) as f:` close the file even if the body raises?

Solution: The with-statement is try/finally around __enter__/__exit__. You still see the exception unless __exit__ swallows it.


Answer: Use with lock: so release runs if the critical section raises. Hand-paired acquire/release is easy to skip on error paths.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: When should you write a context manager for a lock versus calling acquire/release by hand?

Solution: Locks, files, and sessions are the usual with-targets because cleanup must be reliable.


Answer: No. The annotation is not enforced at runtime. A type checker can still flag append('a').

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Does `x: list[int] = []` prevent appending a string at runtime in CPython?

Solution: Hints document intent. Runtime checks need isinstance or a validator.


Answer: It documents that None is a legal value. A plain str hint tells checkers that None is a mistake.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is `Optional[str]` written as `str | None` in modern Python, and what does it allow that `str` does not?

Solution: Callers must handle None. The union is the type, not a runtime conversion.


Answer: The default encoding is locale-dependent, so the same bytes can decode differently on another machine.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why should you pass encoding='utf-8' when opening text files rather than relying on the default?

Solution: Pin UTF-8 for portable text. Binary mode is for bytes that are not text.


Answer: Text mode used a locale encoding on write. Readers assuming UTF-8 mis-decode. Write with encoding='utf-8'.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A script writes JSON with `open(path,'w')` on Windows and a later reader on Linux sees garbage around non-ASCII. What went wrong?

Solution: JSON should be UTF-8. Never depend on the ANSI code page for interchange.


Answer: BFS expands by hop count, so the first time you reach a node is via a minimum number of edges. DFS can dive down a long path first.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why does BFS find a shortest path in an unweighted graph while DFS generally does not?

Solution: Unweighted shortest path = fewest edges. Weights need Dijkstra or Bellman-Ford instead.


Answer: 4

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: An undirected graph has 4 vertices and is a square (cycle of 4). How many edges does it have?

Solution: A C4 has four vertices and four edges.


Answer: Equal keys keep their original relative order. Mergesort is typically stable; heapsort is not.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What does it mean for a sort to be stable, and name one algorithm that is typically stable?

Solution: Stability matters when you sort by one key and then another. Unstable sorts can scramble the first key's order.


Answer: There are n! possible orders. Each comparison has two outcomes, so you need log2(n!) comparisons, which is Theta(n log n) by Stirling.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why is comparison sorting Omega(n log n) in the worst case in the comparison model?

Solution: Decision trees of height h distinguish at most 2^h leaves. n! > 2^{o(n log n)}.


Answer: Optimal substructure and overlapping subproblems. You store answers to repeated subproblems instead of recomputing them.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What two properties make a problem a candidate for dynamic programming?

Solution: If subproblems do not overlap, divide-and-conquer without a table is enough. If they do, memoization or a bottom-up table pays off.


Answer: 2

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Naive recursive Fibonacci without memoization computes F(5). How many times is F(3) evaluated in the standard tree F(n)=F(n-1)+F(n-2) with F(0),F(1) bases?

Solution: F(5) calls F(4) and F(3). F(4) calls F(3) and F(2). F(3) appears twice.


Answer: The outcome depends on unsynchronized interleaving of accesses to shared state, so two runs with the same inputs can disagree.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: What is a race condition, in one operational sentence?

Solution: Fix by keeping data thread-confined, using locks/atomics, or avoiding shared mutation.


Answer: Both read 0, both write 1. The increments are not atomic.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Two threads do `x = x + 1` on a shared integer without a lock. Why can the final x be 1 after both have 'incremented' once from 0?

Solution: Read-modify-write is three steps. A lock, or an atomic add, makes the pair one critical section.


Answer: Each process has its own virtual address space. The OS maps those addresses to physical memory separately.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: Why can two processes not see each other's local variables even though they run on the same CPU?

Solution: Isolation is a memory-management invariant. Shared memory exists only if explicitly requested.


Answer: User code is not allowed to access device memory or other processes' pages directly. The syscall is the controlled crossing.

Original Open Reason wording. Do not treat this as a copy of a named course.

Identify the concept
Apply it
State the answer

Prompt: A user program calls read() and the kernel copies bytes into the process buffer. Why must that copy (or an equivalent mapping) be mediated by the kernel?

Solution: Protection rings / user vs supervisor mode. Drivers and page tables live on the kernel side.