exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 197 discussion

Actual exam question from Oracle's 1z0-808
Question #: 197
Topic #: 1
[All 1z0-808 Questions]

Given the code fragment:
and the requirements of the application:
1. It must display the menu.
2. It must print the option selected.
3. It must continue its execution till it reads '0'.
Which code fragment can be used to meet the requirements?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: A

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
iSnover
Highly Voted 2 years, 3 months ago
The correct answer is the letter C and I will explain: A -> Need to display the menu, the code doesn't have that. Besides, you can't read the variables in the increment of a for, if you want, it has to be done inside it. B -> Wrong, the menu must be shown, if the input is 0 the menu is not even displayed and the application is terminated. C -> It is correct, the menu appears and the data is read, if it is different from 0, the code continues. D -> Wrong, while boolean expression accepts 0 as an answer to continue.
upvoted 5 times
...
MPignaProTech
Most Recent 2 months, 2 weeks ago
A is the correct answer. The only place where option is initialized
upvoted 1 times
...
akbiyik
2 years, 1 month ago
The correct answer is C.
upvoted 4 times
...
alex_au
2 years, 3 months ago
The main problem of B and D is that 'option' is even not initialized, which cannot be compiled
upvoted 1 times
...
shivkumarx
2 years, 4 months ago
Answer can not be A option D is correct
upvoted 2 times
iSnover
2 years, 3 months ago
Wrong, the software stops when 0 is selected. In the condition to continue is "option >= 0", even if it receives the value 0, the code continues.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago