Question
1. Match the following data types to values that they would hold. '&' Richland 95 a. bool true b. double 736.012 c. string 15.0 d.
1. Match the following data types to values that they would hold.
'&'
"Richland"
95 a. bool
true b. double
736.012 c. string
15.0 d. int
"Y" e. char
'y'
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.
a)True
b)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.
a)True
b) False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started