Oracle
1Z0-809 · Question #163
1Z0-809 Question #163: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #163. The question stem and answer options stay visible for context.
Question
Given the code fragment:
public static void main(String[] args) {
int array[] = {10, 20, 30, 40, 50};
int x = array.length;
// line n1
}
Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order?
Options
- Awhile (x > 0) { System.out.print(array[--x]); }
- Bdo { --x; System.out.print(array[x]); } while (x >= 0);
- Cdo { System.out.print(array[x]); --x; } while (x >= 0);
- Dwhile (x >= 0) { System.out.print(array[x]); --x; }
- Ewhile (x > 0) { System.out.print(array[x]); }
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.