Exam 1z0-811 All QuestionsBrowse all questions from this exam
Question 2

Given the code fragment:

What is the result?

    Correct Answer: B

    The code initializes a boolean variable 'checkOut' to true and an integer variable 'days' to 0. It then enters a while loop that continues as long as 'checkOut' is true. Inside the loop, 'days' is incremented by 1 on each iteration. When 'days' becomes greater than 3, 'checkOut' is set to false, ending the loop. At this point, 'days' is 4, so 'System.out.print(days);' will output 4.

Discussion
supercoderOption: B

will print Sysout only one time when pointer exits from while loop that is days = 4. So B is correct answer

tabrezshaikh13Option: B

B is the correct answer.

falchettoOption: B

Correct answer is B