1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 68


Given the code fragment:

What is the result?

Show Answer
Correct Answer: C

The initial value of variable i is 10, and the initial value of j is 5. The code fragment i += (j * 5 + i) / j - 2; follows the order of operations as per BODMAS/BIDMAS rules (Brackets, Orders (i.e., powers and square roots, etc.), Division and Multiplication, Addition and Subtraction). Firstly, evaluate j * 5, which is 5 * 5 = 25. Next, add the value of i, which is 10, resulting in 25 + 10 = 35. Then, divide 35 by j, which is 5, so 35 / 5 = 7. Finally, subtract 2 from 7, giving 7 - 2 = 5. Adding this result to the initial value of i, 10 + 5 = 15. Therefore, the result is 15.

Discussion

10 comments
Sign in to comment
ObaltOption: C
Feb 8, 2023

Correct answer is C. BODMAS

StavokOption: C
Jul 17, 2023

C is correct

Mukes877Option: C
Jun 1, 2023

C is Correct

RoxyFoxyOption: C
Jun 13, 2023

i+=(5*5+10)/5-2, so i+=5 is 15)

tmuralimanoharOption: C
Jun 29, 2023

Answer:C

KiraguJohnOption: C
Jul 7, 2023

C ans = i+35/5-2 = 15

OmnisumemOption: C
Sep 7, 2023

Tested: C.

d7bb0b2Option: C
Jan 7, 2024

var i = 10; var j = 5; i += (j*5 +i)/j-2; System.out.println(i); //15 => 10+(35/5)-2 = 15

mendjijetOption: C
Feb 8, 2024

C is correct tested

ASPushkinOption: D
Jul 22, 2024

i = 10+((5*5+10)/5 - 2)