Title: Quiz: Intro to C++
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD

This quiz consists of multiple choice questions.  Please select the best answer for each question.

Q: The C++ statement to print the string "Hello" is :
- cout << "Hello";
- cout << '\"' << Hello << '\"';
- cout << " "Hello" ";
- cout >> "\"Hello\"";
A: cout >> "\"Hello\"";
If wrong: The C++ statement to print the string "Hello" is : cout >> "\"Hello\"";

Q: The C++ identifier CanOfWorms considered to be the same as:
- canofworms
- CANOFWORMS
- canOfWorms
- all of the above
- none of the above
A: none of the above
If wrong: C++ is case sensitive so none of the above is the correct answer.

Q: In the following C++ expression  x % 7 + y * 3 / 5
- 3 / 5 will be performed first
- x % 7 will be performed first
- y * 3 will be performed first
- 7 + y will be performed first
- none of the above
A: x % 7 will be performed first
If wrong: Order of operations states that multiplication, division and modulo from left to right are performed before addition and subtraction. Therefore, x % 7 would be performed first.

Q: Given that age is an integer variable, what is the output of the following program fragment?

age = 29;

“Are you” << age << “years old?"
- Are you29years old?
- Are you 29 years old?
- Are you29 years old?
- Are you 29years old?
- Are you age years old?
A: Are you29years old?
If wrong: The correct answer is Are you29years old?

Q: The value of the expression  11 + 22 % 4  is:
- 13
- 1
- 8
- 16
- none of the above
A: 13
If wrong: Order of operations would dictate that 22 % 4 would be calculated first. 22 divided by 4 results in a remainder of 2. 2 would then be added to 11 which gives a result of 13 for the equations.