Question 1:
What is the value of the i variable? float x = 1.0 / 4.0; int i = x;
Answer:0
Question 2:
Which of the following strings is a proper floating-point number (in the C++ language sense)?
3.14
Question 3:
What is the output of the following snippet if a digit 5 followed by Enter is entered through the keyboard?
10-125
Question 4:
What is the final value of the k variable?
int i = 3, j, k;
2
Question 5:
Which of the following strings is a correct integer number (in the C++ language sense)?
3'14
Question 6:
What is the value of the k variable? int i = 1; int j = ++i; int k = j++;
2
Question 7:
Which of the following strings does not represent a valid variable name?
auto
Question 8:
What is the value of the following literal?
0x1AAnswer:26
Question 9:
What is the value of the following literal?
0E1Answer:0
Question 10:
What is the value of the x variable?
float x = 1. / 2. + 2. / 4.;
1.0
Question 11:
What is the value of the k variable?
int k = 1 % 2 + 4 % 2;
1
Question 12:
Which of the following strings represents a legal variable name?
first_literal_is_invalid
Question 13:
What is the output of the following snippet if a digit 8 followed by Enter is entered through the keyboard?
81010
Question 14:
What is the value of the following literal?
X10
The literal is invalid.
Question 15:
What is the final value of the k variable?
int i = 3, j = 2, k = -1;
5
Question 16:
What is the value of the following literal?
-1e-1
-0.1
Question 17:
What is the output of the following snippet if a string 2.5 followed by Enter is entered through the keyboard?
X
Question 18:
What is the output of the following snippet?
int i = 3, j = ++i, k = ++i;
545
Question 19:
What is the value of the following literal?
010
8
Question 20:
What is the value of the following literal?
018
Answer:
The literal is invalid.
