EGR 106 Quiz 3 Practice
What is the logical value of the following expression? 9 && !4; True or False
False
What is the logical value of the following expression? 2 < 5 < 3; True or False
True
What is the logical value of the following expression? 3||!(2<3)||0; True or False
True
Which of the following is an example of an arithmetic expression? a. myVar + 5 b. myVar = 5 c. myVar1 > myVar2 d. myVar & 0x80
a. myVar + 5
What is the value and effect of the following expression? 2.55*2; a. Value: 5.10 Effect: none; b. Value: 5.10 Effect: 5.10 c. Value: 5 Effect: none d. Value: 5 Effect: 5
a.Value: 5.10 Effect: none;
What is the value of the following expression? 18%4; a. 1 b. 2 c. 0 d. 4
b. 2
Which of the following is an example of an assignment expression? a. myVar + 5 b. myVar = 5 c. myVar1 > myVar2 d. myVar & 0x80
b. myVar = 5
Which of the following is an example of a logical/relational expression? a. myVar & 0x80 b. myVar + 5 c. myVar1>myVar2 d. myVar = 5
c. myVar1>myVar2
What value is stored to x in the following expression? float x = 3/2 + 1.0; a. x = 1.0; b. x = 1.5; c. x = 2.0 d. x = 2.5
c. x = 2.0
What is the value of the following expression? (4+1)%5; a. -1 b. 1 c. 5 d. 0
d. 0
What value is stored to x in the following expression? float x = (float) (3/2) + 1; a. 2.5 b. 1.5 c. 1.0 d. 2.0
d. 2.0
What is the value of the following expression? (int)3.15 +5/3; a. 4.666667 b. 5 c. 4.816667 d. 4
d. 4
What is the value of the following expression: 3/(float)2 + 3; a. 4 b. 3 c. 5 d. 4.5
d. 4.5
What is the value and effect of the of the expression on the second line below? int v = 3; v++; a. Value: 4 Effect: 4 --> v b. Value: 3 Effect: 3 --> v c. Value: 4 Effect: None d. Value: 3 Effect: 4 --> v
d. Value: 3 Effect: 4 --> v
What is the value and effect of the expression on the second line below? int v = 3; ++v; a. Value: 3 Effect : 4 --> v b. Value: 4 Effect : None c. Value: 4 Effect : 3 --> v d. Value: 4 Effect : 4 --> v
d. Value: 4 Effect : 4 --> v
What is the value and effect of the following expression? (x = 5+4)+1; a. Value:9 Effect: none b. Value:9 Effect: 10 --> x c. Value:9 Effect: 9 --> x d. Value:10 Effect: 9 --> x
d. Value:10 Effect: 9 --> x