Question 17 / 90:  Which conditional statement would be best suited for determining the flow of code based on an int that may have a value between 1 and 10? The program must react differently for each value.
A  if-else statement
B  if-else-if statement with multiple if-elses
C  multiple if statements
D  switch statement
<< First < Previous Flashcard Next > Last >>
Explanation:

D. A switch statement is best suited for situations where multiple possible conditions exist that must be accounted for.

A, B, and C are incorrect.

A is incorrect because the if-else statement only allows two conditions and this question calls for ten conditions.

B and C are incorrect because a combination of if statements should be used only when limited conditions are being checked.

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

My OCA Mock

Author:

Access: Public Instant Grading

Ask
Saylor Foundation
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>