PAGETURNER
CLEAN
BOX
REVIEW
GO
Given the following:
int x = -7, y = 7, z; /* before the operations */
What will the values of the variables be after
the operation z = x++ * --y;
a z = 49; x = -7; y = 6;
b z = -56; x = -6; y = 6;
c z = -42; x = -6; y = 6;
d z = -36; x = -6; y = 7;
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review Topic 3: Arithmetic Conversions
FORGET1
The correct choice is c since y will be decremented prior to
the multiply operation and x will be incremented after the operation.
Given:
int x=-7, y=7, z=-4;
Which two statements are equivalent ?
a y = ( y > x) ? 7 : z - 14;
b if ( x > y) y = 7; else z = z-14;
c z = (x > y) ? z-14 : 7;
d if (y > x) y = 7; else y = z-14;
e a and b
f c and d
g a and c
h a and d
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review Topic 3: Arithmetic Conversions
FORGET2
The correct choice is h , because of the logic of the ternary operator.
Look at the following code:
int a = 7, total=1;
float b = 0.25;
:
switch (total) {
case 0: printf("The simple rate"); break;
case 1: printf("The prime rate");
case 2: printf("The double rate");
case 3: printf("The triple rate"); break;
}
The result produced by this code will be:
a The double rate
b The prime rate, the double rate, and the triple rate
c The prime rate
d The prime rate and the double rate
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review Topic 5: The switch Statement
FORGET3
The correct choice is b , since total matches the case with total = 1.
Because there is no break after the case 1, the control will
fall through all the following printf() statements.
Given the operands:
int i = 7; float f = -3.5; double d = 15;
int c = 'K';
The internal representation of the result of d + i; is:
a double
b char
c short
d int
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review Topic 3: Arithmetic Conversions
FORGET4
The correct choice is a because the
larger type (the type with higher precision)
is always the type of the intermediate result.