Programming Fundamentals Using C++

Midterm review guide

Exam format: 100 minutes · 50 marks. Conceptual ≈ 40 %, applied ≈ 60 %. Question shapes: MCQ, output tracing, debugging, short conceptual, algorithm design (IPO/decision tables), coding, code completion. A closed-book paper — no compiler, so practice writing code by hand.

What to be fluent in

ModuleMust-have skillsPractice from
M1 · Intro & toolchain4 translation stages; error classes (syntax/runtime/logic)Quiz 01, L01–L02 notes
M2 · Variables & I/Obrace init vs narrowing; cin >> whitespace rules; fixed/setprecisionQuiz 02, exercises T01
M3 · Operatorsprecedence, integer division vs %, cast for averagesQuiz 03, examples/precedence_demo.cpp
M4 · Decisionsladder ordering, switch fall-through, short-circuit guardsQuiz 04, exercises T02
M5 · Loopsfor/while/do-while boundaries; priming read; missing-update classQuiz 05, exercises T03
M6 · Problem solvingIPO charts, trace tables, boundary test sets, decompositionQuiz 06, case studies Tier 1–2
M7 · Functionsprototypes, pass-by-value vs reference, contracts, overloadingQuiz 07, exercises T05
M8 · Advanced functionsrecursion base cases, scope/shadowing, default argumentsQuiz 08, examples/recursion_towers.cpp

Hand-trace drills (answers at the week's lecture notes)

  1. int s{0}; for (int i{1}; i <= 3; ++i) s += i * i; → ?
  2. int n{25}, c{0}; while (n > 0) { n /= 2; ++c; } → c?
  3. int g(int n){ return n <= 0 ? 0 : n + g(n - 2); } — g(7)?
  4. void tweak(int a, int& b){ ++a; ++b; } with p = q = 4 → p, q?

Debugging patterns to recognize

Coding practice set (closed-book)

  1. Temperature C→F with input validation, 1 decimal.
  2. Median of three integers.
  3. Sentinel-0 stats: count, sum, mean (2 dp) or no data.
  4. bool isPerfect(int n) + all perfect numbers ≤ 10000.

Exam technique

See also ../final/review_guide.md after Week 8.

Programming Fundamentals Using C++ · C++17 · 16 weeksBack to top ↑