Syntax & Symbols
Basic C++ Math
Incorrect Variables
Errors
100

The two ways to add comments

// and /* ... */

100
What is the result of the expression 7 / 2?

3 (remainder is discarded in integer division)

100

Why is the variable name 6pack illegal in C++?

Variable names cannot start with a number.

100

What kind of error occurs if you forget a semicolon at the end of a statement?

A compiler error (or syntax error)

200

The name of the >> operator used with cin

The extraction operator

200

int x = 1;

x++;

x++;

x--;

What is the value of x?

2

200

Why is the variable name "can volume" illegal in C++?

Variable names cannot contain spaces

200

If you define int Main() instead of int main(), what specific error occurs?

A link-time error (the linker cannot find main)

300

The command used to print text

cout

300

What is the result of 7.0 / 2

3.5

300

Why is the variable name "double" illegal in C++?

You cannot used reserved words as variable names
300

If your program attempts to execute the statement: cout << 10 / 0;, what error occurs?

A run-time error, specifically a "Divide by zero" exception

400

What is the name of the "=" operator?

The assignment operator

400

What is the result of the expression 7 % 2

1

400

Why is the variable name ltr/fl.oz not allowed?

Variable names cannot use symbols such as "/" or "."

400

When the compiler lists a lot of errors, which one should you attempt to fix first?

The first one encountered, as it likely caused the subsequent ones.

500

What does the reserved word const do to a variable?

Makes it so the variable's contents cannot be changed and must be set when created

500

What is wrong with the expression: (-(b * b - 4 * a * c) / (2 * a) ?

The parentheses are unbalanced.

500

Why should you exercise caution when using a variable name like "Can_volume" ? 

It is generally best practice to name variables in all lower case because variable names are case-sensitive.

500

What is the term for a severe run-time error signal from the processor that aborts a program?

An exception