C++ Basics · Chapter 13
Revision and Final Practice – C++ Fundamentals
Revisit every major concept from the C++ series, test your knowledge with a 40‑question quiz, and tackle practical coding exercises to prepare for exams or advanced topics.
By Arj
Updated July 2025
20 min read
All topics covered
What you'll gain
- Revisit all major topics covered in the C++ series
- Strengthen your understanding with quick concept checks
- Test yourself with a 40‑question comprehensive quiz
- Solve practical coding exercises
- Know what to revise before your exam or next course
1Topic-by-topic revision
1. Basics & Syntax
main()function is the entry point of every C++ program.- Use
#includeto include standard libraries. coutandcinfor output and input.
Quick check
Write a program that reads a number and prints it.2. Variables & Data Types
- Use
int,float,double,char,bool, andstring. - Constants are declared with
const.
Quick check
Declare a double for temperature and a bool for status.3. Control Flow
- Use
if,else if, andelseto make decisions. - Combine conditions with
&&,||,!.
Quick check
Write a program that checks if a number is even or odd.4. Loops
- Use
for,while, anddo-while. - Use
breakandcontinueto control loop flow.
Quick check
Print numbers from 10 to 1 using a for loop.5. Arrays & Vectors
- Arrays have fixed size:
int arr[5]; - Vectors are dynamic:
vector<int> nums; nums.push_back(5);
Quick check
Store 5 numbers in a vector and print the sum.6. 2D Arrays
- Syntax:
int matrix[3][3]; - Use nested loops to access elements.
Quick check
Input a 3×3 matrix and print its transpose.7. Input / Output
- Use
cin,cout, and formatting from<iomanip>. - Use
<fstream>for reading/writing files.
Quick check
Write 3 lines to a file, then read and print them.8. Functions
- Use parameters, return values, and function overloading.
- Pass by value or reference.
Quick check
Write a function int max(int a, int b).9. Memory & Pointers
- Stack vs Heap.
int* p = new int; delete p;- Use
&(address-of) and*(dereference).
Quick check
Write a function that swaps two values using pointers.10. Recursion
- Use a base case to stop recursion.
- Useful for factorial, Fibonacci, etc.
Quick check
Write a recursive function to compute n!.11. Structures
- Group multiple variables into a custom type.
- Access members using the dot
.operator.
Quick check
Create a Book struct with title, author, and price.12. Classes & Operator Overloading
- Use
classfor encapsulation. - Overload
+,==,<<to improve readability.
Quick check
Write a Fraction class and overload the + operator.2Practice problems
Try solving these to test your complete understanding:
1. Student Records Manager
Use a struct Student with name, roll number, and GPA.
- Input and store data for
nstudents. - Display all students with GPA above 3.5.
2. Basic Calculator
- Create a function for each operation:
add,subtract,multiply,divide. - Ask the user to select an operation and two numbers.
- Display the result.
3. Matrix Operations
- Input two 2×2 matrices.
- Write functions to: add, multiply, and transpose.
4. Mini Game – Number Guessing
- Generate a random number.
- Let the user guess until they get it right.
- Give hints: "too high" or "too low".
5. Library System (Advanced)
- Use a
Bookclass withtitle,author,copies. - Allow user to: add books, search by title, borrow and return books.
3Final tips
- Practice writing full programs, not just snippets.
- Debug step-by-step and use output statements to track variable values.
- Focus on clear naming and code readability.
- Don't memorize – understand how concepts connect.
- Use online judges like HackerRank, Codeforces, or LeetCode to practice.
440‑question quiz
C++ Fundamentals – 40 Questions
Question 1 of 40
🎉 Final word
You have now completed the full C++ foundational course here on painlessprogramming.com. Whether you are a university student or a self-learner, this knowledge gives you the confidence to tackle more advanced topics like:
- ✓ Object-Oriented Design
- ✓ Data Structures and Algorithms
- ✓ Competitive Programming
- ✓ Real-World Projects
