Final (No-Resource Section) — Calibrated Study Guide🔗
Starting point: raw/final/past_final_no_resource_section.md (a reference exam from a previous
semester). Cross-referenced against everything with direct evidence in this course's actual
materials — Quiz01-10, Tutorial07/09, CppBook, and what got tested in Practice/Project work —
since the course was restructured this semester ("I will need to cut a couple of modules,"
per the 2026-07-20 announcement) and a prior-semester final may not match 1:1.
Removed from the original 20 — no evidence anywhere in this course as taught🔗
- Q12 (Waterfall Method stage) — "Waterfall"/"SDLC" appears nowhere in any course material.
- Q17 (Strategy Pattern) — Design Patterns was Module 12 in the original tentative schedule;
raw/module-11,module-12,module-13don't exist in the scrape at all. The course never reached that material.
Everything else in the original 20 checks out — grounded in Modules 1-10 as actually covered.
New questions covering confirmed gaps🔗
1. Unit Testing Framework🔗
Question: Which testing framework/library did this course use for writing unit tests?
- Answer:
doctest - Explanation: Introduced in Module 4 ("Unit Testing and Software Development"), used directly in Practice04. Notably, the entire module had zero representation in the original 20 questions.
2. Virtual Destructors🔗
Question: Why must a base class's destructor be virtual if you ever delete a derived object through a base class pointer?
- Answer: Without a virtual destructor, only the base class's destructor runs — any derived-class-only resources leak, and derived member destructors never fire.
- Explanation: Tested three separate times across Quiz09 (as its own question, as a True/False, and as a fill-in-the-blank) — clearly one of the most emphasized concepts in this course, yet absent from the original 20 entirely.
3. dynamic_cast🔗
Question: What does dynamic_cast<Derived*>(basePtr) return if basePtr doesn't actually point to a Derived object?
- Answer:
nullptr - Explanation:
dynamic_castis the runtime-checked cast for polymorphic types (requires the base to have at least one virtual function).static_castwould compile but skip this safety check entirely — silently producing an invalid pointer instead of a detectablenullptr.
4. override and final🔗
Question: What does marking a function override protect against, and what does final additionally prevent?
- Answer:
overridemakes a signature mismatch with the base's virtual function a compile error instead of silently creating an unrelated new function.final(on a class or a method) blocks further inheritance or further overriding. - Explanation: Both explicitly tested in Quiz09 — completely absent from the original 20 despite being named, specific keywords likely to show up as fill-in-the-blank material.
5. weak_ptr and Circular References🔗
Question: Two objects hold shared_ptrs to each other. What happens, and how do you fix it?
- Answer: Neither object's reference count ever reaches zero, so neither gets destroyed — a leak. Fix by making one side of the link a
weak_ptrinstead, since it observes without incrementing the count. - Explanation: Quiz10 tested this exact scenario directly, including the book's own doubly-linked-list example.
weak_ptrwasn't mentioned in the original 20's single smart-pointer question at all.
6. Creating Smart Pointers🔗
Question: What's the preferred way to create a unique_ptr<T> and a shared_ptr<T>, and why avoid constructing them from a raw new directly?
- Answer:
std::make_unique<T>(...)andstd::make_shared<T>(...). Wrapping a rawnewpointer by hand risks creating two independent owners of the same memory (double free) if done more than once, andmake_sharedadditionally allocates the object and its control block together in one step. - Explanation:
make_sharedwas tested directly in Quiz10; Practice10's constraints explicitly forbid rawnewfor this exact reason. Not covered by the original 20's smart-pointer question.
7. RAII🔗
Question: What does RAII stand for, and what's the core idea?
- Answer: Resource Acquisition Is Initialization. A resource (memory, file handle, etc.) is tied to an object's lifetime — acquired in the constructor, released in the destructor — so cleanup happens automatically and can't be forgotten, even if an exception is thrown.
- Explanation: Named directly in the Module 10 syllabus topic list ("Ownership semantics and RAII") and is the conceptual foundation smart pointers are built on. The original 20 tests the symptom (raw pointers don't auto-manage memory) but never the name of the underlying principle.
8. Plain enum vs enum class🔗
Question: What's the key practical difference between a plain enum and an enum class, and which did Project03 specifically require?
- Answer:
enum classvalues are scoped (Status::ONGOING) and don't implicitly convert toint; plainenumvalues are unscoped (ONGOING) and do. Project03's spec explicitly required plain enums, a deliberate downgrade from Project01'senum class. - Explanation: A real, recurring design decision across this course's own assignments (Project01 vs. Project03), not covered by the original 20 at all.
9. The "Most Vexing Parse"🔗
Question: Why does Animal b(); not create an Animal object with default arguments?
- Answer: It's parsed as a function declaration — a function named
b, taking no parameters, returning anAnimal. To default-construct an object, useAnimal b{};or justAnimal b;. - Explanation: This exact example was taught and tested in Tutorial07, flagged as a specific, well-known gotcha in CppBook. A classic "looks like object creation, is actually a function declaration" trap worth recognizing on sight.
10. Rule of Zero🔗
Question: What is the "Rule of Zero," and why is it preferred over the Rule of Three/Five?
- Answer: Design your class so it needs none of the five special member functions (destructor, copy/move constructor, copy/move assignment) written by hand — let members like smart pointers,
std::vector, andstd::stringmanage their own resources. - Explanation: CppBook explicitly frames this as the preferred target ("Aim for the rule of zero... you rarely write move constructors yourself"), a step beyond just knowing the Rule of Five exists (which the original Q20 already covers).