nerdexam
Oracle

1Z0-811 · Question #40

1Z0-811 Question #40: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-811 to reveal the answer and full explanation for question #40. The question stem and answer options stay visible for context.

Arrays and Logic

Question

Given the code fragment: int[] num = new int[2]; num[0] = 10; num[1] = 15; List<Integer> lst = new ArrayList<>(2); lst.add(10); lst.add(15); num[1] = 20; lst.add(20); for (int x: num) { System.out.print(x + " "); } System.out.println(""); for (int y: lst) { System.out.print(y + " "); } What is the result?

Options

  • A10 20 10 15 20
  • BA runtime exception is thrown.
  • C10 20 10 20
  • DA compilation error occurs.

Unlock 1Z0-811 to see the answer

You've previewed enough free 1Z0-811 questions. Unlock 1Z0-811 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.

Topics

#arrays#ArrayList#enhanced-for-loops#type-compatibility
Full 1Z0-811 Practice