Chapter 4 Quiz Starting Out With C++ 008

What is the value of the relation expression below, given that x is 5 and y is 1.  z is a bool.

z = x < y;

a. true
b. false
c. 1
d. 0
e. None of the above, you can't assign result of expression, only test it

Chapter 4 Quiz Starting Out With C++ 007

(bonus question) How does C++ handle true or false with regards to storing these values. Mark all that apply, if any

a. only a 1 is equal to true.
b. only 0 is considered true.
c.  a 0 is considered false.
d. anything other than 0 is considered true.
e. None of the above, they are stored as T or F.

Remember the lecture from Monday on making decisions and you'll do fine.

Chapter 4 Quiz Starting Out With C++ 006

In the following, what is the value of the expression given that the value of x is 5?

x == 5

a. x
b. 5
c. false
d. true

Chapter 4 Quiz Starting Out With C++ 005

What does the ! (exclamation symbol) mean in c++?

a. It tells the compiler to check this condition first
b. It means not or the opposite of what the comparison is.
c. It is a shortcut so you don't have to enter 'true' or a relational comparison operator
d. None of the above

Chapter 4 Quiz Starting Out With C++ 004

What is the difference between = and == in C++?

a. They are the same but the == makes it more visible to the programmer
b. == is used to assign a value to a variable and = is used to compare.
c. = is used to assign a value to a variable.
d. == is used for comparison and = is used to assign

Chapter 4 Quiz Starting Out With C++ 003

How do you write "greater than or equal to" test in c++?

a. gte
b. > or =
c. >=
d. > && =