Given int x = 7, what value does the expression x / 2 * 2 produce?
-
A
3
-
B
6
Correct answer
-
C
7
-
D
8
14 views
Explanation
Integer division truncates 7/2 to 3, and 3 * 2 gives 6.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ