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.
This is the assignment operator in C++
=
This is an expression, commonly used in decision structures, evaluates to either true or false.
Condition
The three main types of loops in C++.
while, do while, and for
This is the purpose of the return statement.
To return a value from the function to the caller and terminate the function’s execution.
This is the first step in the C++ compilation process.
Preprocessing
The result of 7 / 2 in C++.
3, as both operands are integers, C++ will perform floor or integer division.
This control structure only works with integers
Switch
This structure executes code, then repeats the execution as long as a condition is true.
do while
The region of code where an object is accessible.
Scope
The name and purpose of the required function in every C++ Program.
main()
Serves as an entry point into the application.
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
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.
This statement will exit the current iteration of a loop.
continue
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.
This is the C++ compilation process, in order.
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).
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
The three parts of a for loop header.
(intitialization, condition, and increment/decrement)
This is the process by which the compiler generates unique names for overloaded functions.
Name mangling.
Bonus +200: How does this work?
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?
The result of the following:
3 + 2 * 5 > 10 && 4 - 1 < 3 + 2
false
This is the short-circuit evaluation in logical expressions.
In logical AND (&&) or OR (||) expressions, the second condition is only evaluated if necessary.
This is a way to emulate a loop using a function.
Recursion. (though generally less efficient, a function can call itself for repetitive tasks)
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);