Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 68

Given the code fragment:

What is the result?

    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
StavokOption: C

C is correct

ObaltOption: C

Correct answer is C. BODMAS

ASPushkinOption: D

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

mendjijetOption: C

C is correct tested

d7bb0b2Option: C

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

OmnisumemOption: C

Tested: C.

KiraguJohnOption: C

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

tmuralimanoharOption: C

Answer:C

RoxyFoxyOption: C

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

Mukes877Option: C

C is Correct