Free Oracle 1z0-811 Exam Questions

Given:


And the code fragment:


Which code fragment can be inserted at line n1 to enable the code to print All the best?

  1. void writeMsg();
  2. Messenger.writeMsg();
  3. writeMsg();
  4. m.writeMsg();

Answer(s): B



Given the code fragment:



Which two code fragments are valid at line 2?

  1. for (int count = 0; count < 5; count++) {
    System.out.print(count);
    }
  2. package p1;
  3. import java.util.*;
    public void display() {
    List<Integer> nums = new ArrayList<> ();
    }
  4. {
    private int num;
    }
  5. private String name = “John”;
    public void display() {
    System.out.print(name);
    }

Answer(s): B,E



You have been asked to develop a Java program that prints the elements of an array in reverse order. Which looping statement cannot be used to meet the requirement?

  1. enhanced for
  2. standard for
  3. while
  4. do-while

Answer(s): D


Reference:

https://www.javatpoint.com/java-program-to-print-the-elements-of-an-array-in-reverse-order



Given the code fragment:

Which statement is true?

  1. The code results in a compilation error. To make it compile, insert at line n1:
    import java.lang.Math;
    import java.lang.Random;
  2. The code compiles successfully
  3. The code results in a compilation error. To make it compile, insert at line n1:
    import java.lang;
    import java.util;
  4. The code results in a compilation error. To make it compile, insert at line n1:
    import java.util.*;

Answer(s): B

Explanation:



Viewing page 10 of 19



Post your Comments and Discuss Oracle 1z0-811 exam prep with other Community members:

1z0-811 Exam Discussions & Posts