CS U111 · Lab evaluations · Practice ladder
The lab-eval ladder: from a blank file to a real evaluation
Seven stages, each climbing from warm-up to the level of the instructor's real lab evaluations, plus the real evaluations themselves. Every problem is marked the way VPL marks it: five test cases, silent input, exact output. You choose where to start; the page suggests an order.
- Lab evaluations run on VPL (Moodle's Virtual Programming Lab). VPL types the input into your program and compares what you print with the expected output, token by token. Letter case and spacing are ignored, but every word and number must match. There are five test cases, and each one you fail costs 14%.
- So there are no prompts. A
printfasking for input, or a debug print you forgot to delete, ends up in your output and fails every test, even when the logic is right. Every program on this ladder now reads silently and prints only the answer. - The real problems are short. The instructor released 28 past evaluations, and their solutions are 5–15 lines of logic. What they test is careful edge cases (N = 0, N = 1, input 0, negatives, exact boundaries, the order of the rules), not long programs. The ladder's Rung B is now built to that size, and the 28 problems themselves are on the real lab evals page and in the Stage 6 mocks.
- The evaluations seen so far come in three kinds: if/else only, one loop over N inputs (no arrays) and a function with a given prototype. No arrays, strings or recursion evaluation has been released yet. Stages 3–5 use the same format, but their difficulty is our estimate, and the pages say so.
- Lab evaluations are open book, unannounced, best k of n (10%). The end-semester lab exam is also open book (25%).
How every stage is built
Each stage has four rungs. The suggested climb is A → A+ → B, then the real problems for that topic. C is optional.
| Rung | What it is | Time each | Program size |
|---|---|---|---|
| A | Warm-up: one idea, and a first program that compiles | 5–10 min | 3–8 lines |
| A+ | Input patterns: the exact ways evaluations feed input: values on one line · N then N values · T test cases · a given function prototype. Tiny problems whose only job is getting the input shape right. | 5–10 min | 5–10 lines |
| B VPL | VPL level: new problems built like the instructor's evaluations, with five edge-case tests each | 15–20 min | 5–15 lines |
| C | Beyond the eval (optional): longer, lab-sheet-plus-twist programs (menus, patterns, simulations). Good practice for the end-semester lab exam, but longer than any evaluation seen so far. | 25–40 min | 25–40 lines |
Inside each card, open the folded boxes in order and only when you're stuck: Stuck? First move (just the opening: what to read, which variables, what the loop runs over), then Plan in plain words, then the Full solution (compiled with clang -Wall -Wextra, no warnings, and passes all five tests). Open the solution only after your version passes, or after twice the time box.
Self-marking: the five tests
Every card has five test cases. Test 1 is the sample, and the others are the edge cases a real evaluation would try. You can check your program in two ways:
- One test at a time: press Copy input, run your program, paste the input, copy what it prints into the box, then press Check. The check compares like VPL does.
- All five at once: press Download test script, save it next to your
.cfile, and runsh s1-b1-tests.sh b1.cin Terminal. It compiles your file and prints PASS or FAIL for each test, showing the input, the expected output and your output whenever a test fails. Stage 0 walks through this step by step (how a lab evaluation runs your program). - Zero warnings with
-Wall -Wextra. A warning is usually a real bug, like a missing&. - You can explain every line out loud. If you can't, the line came from memory of the solution, so type the problem again tomorrow from a blank file.
The stages
Syntax bootcamp + how VPL runs your program
The skeleton from memory, the compile-run loop, printf/scanf formats, integer vs real division, a decoder for the 12 most common compiler errors, fix-it drills (including "the prompt that fails every test"), then arithmetic programs in VPL format.
Decisions and loops
Rule-priority if/else problems, "print every reason that applies", then one loop over N inputs: counters, totals, streaks, invalid values skipped. This is where 20 of the 28 real evaluations sit.
Stage 2 · Labs 5A, 5B · real evals: functionsFunctions
The function-evaluation format: a given prototype, the body, and a T-loop in main. Predict-the-output on pass-by-value and scope. Rung B is modelled on the six real function evaluations.
Arrays, 1D and 2D
Read N values into an array, then a second pass: above the average, values that appear once, column sums. The format matches the real evaluations; the difficulty is our estimate.
Stage 4 · Lab 7Strings
Reading input safely first (a number followed by a line is the classic VPL trap), then character counts, checks and transformations at evaluation size.
Stage 5 · Lab 8Recursion
Recursive functions in the function-evaluation format: a given prototype, "no loops", and base-case tests. Hand traces with call-stack tables.
The real thing · 22 problemsReal lab evals (instructor bank)
The instructor's evaluations, quoted word for word with their five test cases: 9 if/else, 9 loop and 4 function problems, ordered from easy to hard, with folded hints and solutions.
Stage 6 · timedMock lab evaluations
Mocks 1–3 are six real evaluations held back so you meet them cold (if/else, loops, functions; 45 min each). Mocks 4–6 cover arrays, strings and an integrated problem in the same format. Plus the first-five-minutes routine.
Choose your route
You decide what to work on. These are suggestions for common situations. Within any stage the climb is the same: A → A+ → B → the real problems for that topic. Skip a rung whenever its first problem feels easy.
| Your situation | Suggested route |
|---|---|
| Not sure where you stand (15 min) | Try one real problem cold: the first loop problem on the bank page, 15 minutes, no hints. If it passes all five tests, start at Rung B of the stage you need. If you couldn't start, begin at Rung A+. If it compiled but failed tests, read its trap box, then do Rung B. |
| An evaluation could come this week (~2 h) | Stage 0's "how VPL runs your program" section and its two VPL fix-its (20 min). Then the A+ rung of the current lab's stage, then two of its Rung B problems. Last, skim the lab-eval routine. |
| About a week (~1½–2 h a day) | Day 1: Stage 0 VPL section + Stage 1 A+ and B. Day 2: the bank's if/else and loop problems (do half, timed). Day 3: Stage 2 A+ and B, then the bank's function problems. Days 4–6: A+ and B of the current lab's stage (arrays, strings or recursion). Day 7: Mocks 1–3, one per sitting. Skip Rung C. |
| Two weeks or more | The whole ladder in order, Rung C included, with the bank problems after each matching stage and the mocks at the end. Then redo every problem you marked "needed the solution". |
The daily routine (inside any route): spend 10 minutes retyping yesterday's hardest problem from a blank file, without looking, until it passes all five tests. Then 40–90 minutes of new problems, timed. Finish with 5 minutes adding today's mistakes to a running list ("forgot N = 0", "printed a label"). The retype is what turns "I followed it" into "I can write it".
Reading a solution and nodding feels like progress, but it trains recognition, and a lab evaluation tests recall from a blank file. If you opened the full solution, the problem doesn't count as done. Mark it and retype it from scratch the next day.
What's already on the site, and where it fits
- Teaching (if a rung uses an idea you haven't met): the lesson pages for loops, functions, arrays, strings and recursion.
- Even smaller steps than Rung A: the loops ladder and the arrays ladder. Their programs still print prompts, which is fine for learning, but delete the prompts before anything goes into VPL.
- The sheets' own problems, solved: Lab 4, Lab 5a, Lab 7 and Lab 8. They are longer than evaluations, at about Rung C level.
- Predict-the-output drills (reading code fast): loops, functions and arrays and recursion.
"Here is a C lab-evaluation problem: [paste]. My program fails test [n]: input [paste], expected [paste], mine printed [paste]. Don't rewrite my program. Tell me which input case my logic mishandles, in one sentence."
"Give me one new problem in the same format as this VPL problem: [paste one from the bank]. Silent input, an exact output format, and five test cases including N = 0 or a boundary value. Don't give the solution."
Run anything an AI says a program prints. Its test cases can be wrong, so check them yourself.