Ctrl + C++
Expressions
Branching Out
Loops
Call of Duty
100

This part of a computer is responsible for executing instructions from a program.

- No Abbreviations Accepted-

Central Processing Unit

Bonus +100: Name 4 other key components to a computer.

100

This is the assignment operator in C++

=

100

This is an expression, commonly used in decision structures, evaluates to either true or false.

Condition

100

The three main types of loops in C++.

while, do while, and for

100

This is the purpose of the return statement.

To return a value from the function to the caller and terminate the function’s execution.

200

This is the first step in the C++ compilation process.

Preprocessing

200

The result of 7 / 2 in C++.

3, as both operands are integers, C++ will perform floor or integer division.

200

This control structure only works with integers

Switch

200

This structure executes code, then repeats the execution as long as a condition is true.

do while

200

The region of code where an object is accessible.

Scope

300

The name and purpose of the required function in every C++ Program.

main()

Serves as an entry point into the application.

300

This is the difference between ++x and x++ in C++

++x is the prefix increment, returning x AFTER the increment

x++ is the suffix increment, returning x BEFORE the increment

300

The difference between using a break statement in case and an if statements.

In a case, the break will prevent falling through cases, in an if, the break will exit a containing loop, or cause an error if not within one.

300

This statement will exit the current iteration of a loop.

continue

300

This describes a function prototype.

The declaration of a function that specifies its name, return type, and parameters, but without the function body. It allows the function to be called before its definition.

400

This is the C++ compilation process, in order.

  1. Preprocessing
  2. Compilation
  3. Assembly
  4. Linking
400

This happens if an integer reaches its maximum value + 1.

It Overflows, wrapping around due to undefined behavior, which depends on the architecture (often it wraps modulo the maximum value).

400

The difference between a switch statement and a chain of if-else statements.

switch statement: Single Variable vs. Multiple Values, more efficient

if-else statement: Different conditions for each, more flexible


400

The three parts of a for loop header.

(intitialization, condition, and increment/decrement)

400

This is the process by which the compiler generates unique names for overloaded functions.

Name mangling.

Bonus +200: How does this work?

500

This is the role of the preprocessor in the C++ build process.

The preprocessor handles directives before actual compilation begins.

Bonus: +100: Give an example of a preprocessor directive?

500

 The result of the following:

3 + 2 * 5 > 10 && 4 - 1 < 3 + 2

false

500

This is the short-circuit evaluation in logical expressions.

In logical AND (&&) or OR (||) expressions, the second condition is only evaluated if necessary.

500

This is a way to emulate a loop using a function.

Recursion. (though generally less efficient, a function can call itself for repetitive tasks)

500

What is passing by reference?

Passing by reference sends memory "pointers" to the actual arguments, allowing it to modify the original values. It is implemented by using the & symbol in the function parameters:

void myFunction(int &x);