Classes/Structs
Dynamic Arrays
Pointers
Recursion
Miscellaneous
100

The term used for the instantiation of a class. Example: Car Porsche;

What is an object?

100

This is the correct syntax to access the third element of a dynamic array arr.

What is arr[2]?

100

 A symbol that can be placed before a variable to give its address in memory.

What is &?

100

This condition must be met to stop a recursive function from calling itself indefinitely.

What is the base case?

100

What keyword in C++ is used to define a constant variable whose value cannot be changed?

What is const?

200

This keyword is used to return memory to the system that was previously allocated using new.

What is delete?

200

This keyword is used to allocate memory for a dynamic array.

What is new?

200

A symbol that can be added in front of a pointer to retrieve data that pointer is pointing to (Deferencing).

What is *?

200

Recursion is often used to solve problems that can be broken down into these.


What are smaller subproblems?

200

In which algorithm are elements repeatedly swapped to sort the array until no more swaps are needed?

What is bubble sort?

300

This special function automatically cleans up the memory when an object is destroyed in C++.

What is a destructor?

300

A dynamic array-like container that is part of a C++ library and allows for dynamic sizing and automatic memory management

What is a vector?

300

This pointer is used in a linked list to point to the next node in the sequence.

What is the next pointer?

300

In recursion, this space is used to store information about each recursive call, such as parameters, return addresses, and local variables.

What is the call stack?

300

What is the term for the memory region where dynamically allocated memory (using new or malloc) is stored?

What is the heap?

400

This operator is used to access a member of a struct or class using a pointer to that object.

What is the arrow operator (->)?

400

A member function of the vector class, and is used to add an element to the end of the vector, dynamically increasing its size.

What is push_back()?

400

Inserting a node at the end of a linked list typically requires traversal starting from this.

What is the head node?

400

This is a recursive algorithm used for sorting that divides the array into halves.

What is Merge Sort (or Quicksort)?

400

This special function is used to create a new object as a copy of an existing object, ensuring that all member variables are correctly duplicated.

What is a copy constructor?

500

Given the following code snippet, what is the output?
struct Rectangle {

    int width, height;

    Rectangle(int w, int h) {

        width = w;

        height = h;

    }

    int area() { return width * height; }

};

int main() {

    Rectangle rect(5, 10);

    cout << rect.area();

}

What is 50?

500

Given the following code snippet, what is the output?

int* arr = new int[4]{5, 12, 3, 9};

int max = arr[0];

for (int i = 1; i < 4; i++) {

    if (arr[i] > max) max = arr[i];

}

cout << "Max: " << max;

delete[] arr;

What is 12?

500

What does the following code print?

int main() {

    int y = 5;

    int x = 10;

    int* ptr = &x;

    int** ptr2 = &ptr;


    cout << "Value of x: " << **ptr2 - y << endl;

    return 0;

}

What is 5?

500

int fibonacci(int n) {

    if (n == 0 || n == 1) {

        return n;

    }

    ?

}

This one line of code is the recursive part of the recursive function that calculates the nth Fibonacci number. And is represented by the ? above.

 What is return fibonacci(n - 1) + fibonacci(n - 2); ?

500

What is the content of the vector after the following operations?

int main() {
    vector<int> numbers = {9, 3, 12, 8, 5};
   
    numbers.push_back(4);
    numbers.resize(7);
   
    numbers[6] = 7;
   
    numbers.pop_back();
   
    for (int i = 0; i < numbers.size(); i++) {
        cout << numbers[i] << " ";
    }
}

What is "9 3 12 8 5 4"?

M
e
n
u