The Exercise Bank¶
One hundred and sixty exercises covering the whole course. They are the opposite of a reading list: every one of them asks you to do something — answer, trace, predict, break, repair, complete, refactor or design — and each states the level it works at so you can choose the difficulty deliberately.
The exercises are grouped by topic (fourteen topic pages, following the modules) and labelled by difficulty (six levels). A number of them are scenario-based: they give a small realistic setting — a payroll desk, a booking counter, a device farm — and ask you to work inside it rather than on an abstract puzzle.
The six levels¶
| Level | Name | What it asks of you | Typical exercise |
|---|---|---|---|
| L1 | Basic | Recall and recognise | Define a term; name the stage that fails |
| L2 | Practice | Use a construct correctly in a small, given shape | Complete a function; predict the output |
| L3 | Applied | Combine two or three ideas to meet a stated need | Modify a program to add a rule |
| L4 | Analytical | Compare, diagnose, and explain why | Find the bug; list the fragilities |
| L5 | Design | Make decisions where more than one answer is defensible | Design the types for a scenario |
| L6 | Advanced | Design, then evaluate and defend what you chose | Refactor legacy code; review a design |
Levels are about how much freedom you are given, not how long the exercise is. An L5 exercise may be one paragraph; it is still L5 because nothing tells you the answer.
The fourteen topics¶
| # | Topic | Exercises | Count | Scenarios | Modules |
|---|---|---|---|---|---|
| 1 | Mindset and compilation | E01–E11 | 11 | 5 | 1 |
| 2 | Classes and encapsulation | E12–E23 | 12 | 4 | 2, 4 |
| 3 | Constructors and lifecycle | E24–E35 | 12 | 4 | 3 |
| 4 | Operators and static members | E36–E46 | 11 | 4 | 5 |
| 5 | Inheritance | E47–E58 | 12 | 4 | 6 |
| 6 | Polymorphism and interfaces | E59–E70 | 12 | 4 | 7, 8 |
| 7 | Composition and association | E71–E81 | 11 | 4 | 9 |
| 8 | Copying and resource management | E82–E93 | 12 | 4 | 10 |
| 9 | RAII and smart pointers | E94–E105 | 12 | 4 | 11 |
| 10 | Templates | E106–E116 | 11 | 4 | 12 |
| 11 | Exceptions | E117–E127 | 11 | 4 | 13 |
| 12 | The STL with OOP | E128–E138 | 11 | 4 | 14 |
| 13 | SOLID and design patterns | E139–E149 | 11 | 4 | 15 |
| 14 | Refactoring and design | E150–E160 | 11 | 4 | 15, 16 |
Every exercise carries a level tag (L1–L6) and a type tag, so you can also filter
by kind of work. The types covered are:
| Type | Meaning | Type | Meaning |
|---|---|---|---|
concept |
Conceptual question — explain or define | refactor |
Restructure working code without changing behaviour |
trace |
Code tracing — follow the execution by hand | design |
Design problem — choose the structure yourself |
debug |
Debugging — find and fix a defect | class |
Class-design problem |
complete |
Code completion — fill in the missing part | inherit |
Inheritance problem |
modify |
Code modification — change behaviour | poly |
Polymorphism problem |
predict |
Output prediction — write the output before running | memory |
Memory-management problem |
stl |
Standard-library problem | smart |
Smart-pointer problem |
template |
Template problem | pattern |
Design-pattern problem |
solid |
SOLID / responsibility problem |
How to use the bank¶
Attempt before you check anything — including the hints. The bank is deliberately split into three files so you cannot read the answer by accident:
| File | What is in it | When to read it |
|---|---|---|
| The topic pages | The exercises, and nothing else | Always start here |
| Hints | One short nudge per exercise | Only after a genuine attempt has stalled |
| Solutions and answers | A model answer per exercise | Only after your own answer is written down |
A hint is not a solution. Hints point at the idea or the section to reread; they do not contain the finished answer. If a hint gives you the answer, it has failed and you should tell the course maintainer.
Write your answer down first, even for a "design" exercise. For an output prediction, write the exact lines. For a design, write the class names and their one-line responsibilities. It is the written record that lets you compare honestly with the model answer instead of convincing yourself you "would have said that".
There is frequently more than one right answer. For any design, refactor, solid
or pattern exercise, the model answer is one defensible answer, not the only one. What
matters is that yours is justified: you can say why each decision was made.
Compile everything you write. The course's one command is:
A solution that runs but warns has not passed. Several exercises specifically require you to produce a compiler error and explain it — always capture the real message from your own toolchain rather than imagining it.
A suggested route through the bank¶
| If you have… | Do |
|---|---|
| 15 minutes | The L1 and L2 exercises for the module you last studied |
| An hour | Every L2 and L3 on one topic page |
| A week for revision | One topic page a day, L1→L6 |
| An exam coming | All predict, trace and debug exercises — they are the ones exams test |
| Finished the course | The L5 and L6 exercises on topics 13 and 14, then a capstone |
Related: Exercises overview · Labs · Quizzes · Module index