Last Updated: December 6, 2025
30 quizzes
Which statement best describes C++?
Who created C++ and where was it first developed?
Which C++ feature is MOST associated with code reuse and modular design?
Which standard introduced the first official ISO C++ standard?
Compared to C, which capability is a key addition in C++?
Which choice is the BEST reason to use an IDE when learning C++?
In a minimal C++ program, what is the purpose of the function named main?
Which phase of the build pipeline resolves external function calls into final addresses?
Which real-world application commonly uses C++ for its performance and low-level control?
Which modern C++ feature helps manage memory automatically and safely?
Include the correct header to use std::cout
#include <>Click an option to fill the blank:
Complete the line to declare main with the correct return type
main() { return 0; }Click an option to fill the blank:
Use the C++ compiler to build hello.cpp into an executable named hello
g++ hello.cpp helloClick an option to fill the blank:
What is the output of this code?
1#include <iostream>
2using namespace std;
3
4class Animal {
5public:
6 void speak() {
7 cout << "Animal speaks" << endl;
8 }
9};
10
11class Dog : public Animal {
12public:
13 void speak() {
14 cout << "Dog barks" << endl;
15 }
16};
17
18int main() {
19 Dog d;
20 d.speak();
21 return 0;
22}What does this program print?
1#include <iostream>
2
3int main() {
4 int *p = new int(42);
5 std::cout << *p << std::endl;
6 delete p;
7 return 0;
8}What is the output of this C++ vs C style example?
1#include <iostream>
2
3void greet_c() {
4 std::cout << "Hello from C style" << std::endl;
5}
6
7class Greeter {
8public:
9 void greet_cpp() {
10 std::cout << "Hello from C++ style" << std::endl;
11 }
12};
13
14int main() {
15 greet_c();
16 Greeter g;
17 g.greet_cpp();
18 return 0;
19}What is the output after compiling with optimizations disabled?
1#include <iostream>
2
3int add(int a, int b) {
4 return a + b;
5}
6
7int main() {
8 int x = 3;
9 int y = 4;
10 std::cout << add(x, y) << std::endl;
11 return 0;
12}What does this program print about the compilation process?
1#include <iostream>
2
3void step(const char* msg) {
4 std::cout << msg << std::endl;
5}
6
7int main() {
8 step("1. Preprocessing");
9 step("2. Compilation");
10 step("3. Assembly");
11 step("4. Linking");
12 return 0;
13}Find the bug related to memory management in this C-style code
Click on the line(s) that contain the bug.
#include <cstdlib> int main() { int *data = (int*)std::malloc(5 * sizeof(int)); for (int i = 0; i < 5; ++i) { data[i] = i; } // process data return 0;}Find the bug in this first C++ program using std::cout
Click on the line(s) that contain the bug.
#include <iostream> int main() { cout << "Hello" << std::endl; return 0;}Click the line that causes a potential leak when an early return happens
Click on the line to select.
void init_system(bool fail) { int* buffer = new int[100]; // initialize buffer if (fail) return; // early exit delete[] buffer;}Click the line where the C++ program actually starts executing
Click on the line to select.
#include <iostream> void helper() { std::cout << "Helper" << std::endl;} int main() { helper(); std::cout << "Main" << std::endl; return 0;}Complete the Hello World program
<iostream>int main() { std:: << "Hello, World!" << std::; return 0;}Click an option to fill blank 1:
Fill in the C++ class and object usage
class {public: void speak() { std::cout << "Hi" << std::endl; }};int main() { ; .speak(); return 0;}Click an option to fill blank 1:
Complete the use of std::vector from the STL
#include <iostream>#include <>int main() { std::<int> v = {1, 2, 3}; for ( x : v) { std::cout << x << std::endl; } return 0;}Click an option to fill blank 1:
Fill in the RAII-style smart pointer example
#include <iostream>#include <memory>int main() { std::<int> p = std::<int>(); std::cout << *p << std::endl; return 0;}Click an option to fill blank 1:
Match the compilation stage with its main responsibility
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match each tool with its typical role in a C++ environment
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Order the steps to compile and run a simple C++ program from the command line
Drag and drop to reorder, or use the arrows.
Order these actions when setting up a C++ environment with VS Code and GCC
Drag and drop to reorder, or use the arrows.