Answer is D.
To test:
public static void main(String[] args) {
int a = 3;
int b = 2;
int c = 1;
int r1 = a * b / c + 1;
int r2 = a / b * c + 1;
int r3 = a * (b / (c + 1));
System.out.println(r1 + " : " + r2 + " : " + r3);
}
The correct answer is the letter D, remembering that we can divide "int" types even if there is leftover, dividing 3 by 2 would give "1.5" but as the whole number it cuts the decimal places getting "1" and making the code compile normally. Just doing the result of "r1" and "r2" you can already have the result without having to calculate "r3", the OCA test asks questions like this for you to waste time with distractors and time in a test that requires attention in every question is gold.
upvoted 1 times
...
This section is not available anymore. Please use the main Exam Page.1z0-808 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
carloswork
8 months agoiSnover
8 months, 3 weeks ago