Question: 1. Match the following data types to values that they would hold. '&' Richland 95 true 736.012 15.0 Y 'y' a. bool b. double c.
1. Match the following data types to values that they would hold.
'&'
| "Richland" |
95
true
736.012
15.0
"Y"
'y'
a. bool
b. double
c. string
d. int
e. char
2. What is the correct syntax to declare a new variable named bill that holds a number containing decimal places?
| a. | float bill; | |
| b. | double bill; | |
| c. | int bill; | |
| d. | both a & b |
3. What is the correct syntax to declare a new variable named total that will hold an integer value?
| a. | integer total; | |
| b. | double var total; | |
| c. | int total; | |
| d. | int total |
4. What is the output for the following code? (Write only the number with no extra spaces or characters.)
int x = 17, y; x = x * 2; y = x - 3; cout << y;
5. If a = 4; and b = 3;, then after the statement a = b; the original value of a is lost.
True
False
6. Given the following statements, which of the assignment statements below are valid. Mark all that are correct.
int num1 = 40, num2 = 10, newNum = 100; double x = 15.0, y = 5.1;
| a. | num1 = x; | |
| b. | newNum = num1 - num2; | |
| c. | num2 = num1 + 4.6 / 2; | |
| d. | x = 12 * num1 - 15.3; | |
| e. | x / y = x * y; | |
| f. | num1 * num2 = newNum; | |
| g. | num2 + 2 = num1; | |
| h. | num1 = 35; | |
| i. | newNum = x - 5; | |
| j. | x = 35; |
7. In C++, all variables must be initialized when they are declared.
True
False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
