C++ Foundations — Self-Check Quiz

12 questions · ~20 min · attempt all before the answer key — it’s a separate file on purpose · ← Module home

Section A — Structure (Q1–Q3)

Q1. Which list names the four structural parts of a minimal C++ program in the order the compiler encounters them?

Q2. A program contains two main functions. What happens?

Q3. return 0; at the end of main means:

Section B — Data (Q4–Q7)

Q4. Which identifier is illegal in C++?

Q5. The value 3.14 written in code is:

Q6. After these two lines, what does y hold?

int x = 5;
int y = x;
x = 99;

Q7. Why does the course write const int PASS_MARK = 50; rather than using 50 in conditions?

Section C — Operators (Q8–Q10)

Q8. What does std::cout << 7 / 2 << "\n"; print?

Q9. What does std::cout << (2 + 3 < 5) + 1 << "\n"; print?

Q10. After int a = 5; int b = a++; — what are a and b?

Section D — Conversion & mistakes (Q11–Q12)

Q11. double avg = static_cast<double>(total) / count; with total = 17, count = 2 prints:

Q12. Which line contains a bug of the “assignment in a condition” family?


When all 12 are answered: open the answer key (separate file — attempt-first protocol), mark yourself, and follow the bands: ≥ 11 continue; 8–10 revisit flagged sections; ≤ 7 redo the exercises and predictions.

← Module home