Question 12 / 90:  The following short code segment contains two errors. What are they?
Choose 2
int a = 1;

does

a = 2;

while (a == 1)

<< First < Previous Next > Last >>
Explanation:

C and D.

C contains an error because it needs a do-while statement, not an invalid doeswhile statement.

D contains an error because the do-while statement must end with a semicolon.

A and B are incorrect.

A is incorrect because declarations must occur outside of the dowhile statement. As such, the declaration was represented correctly in the code segment.

B is incorrect because when there is only one statement enclosed in the do-while statement, it does not need to be enclosed in braces.

Exam Home Page
https://www.jobilize.com/quiz-my-oca-mock-exam-by-mike-wolf

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Jill Zerressen
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/quiz-my-oca-mock-exam-by-mike-wolf" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>