Java SE 17 Developer v1.0 (1z0-829)

Page:    1 / 4   
Total 50 questions

Assuming that the data.txt file exists and has the following content: text1 text2 text3
Given the code fragment:

What is the result?

  • A. text1-
    text2-
    text3-
    text3
  • B. text1-text2-text3
    A java.lang.IndexOutOfBoundsException is thrown.
  • C. text1-text2-text3
    text1
    text2
    text3
  • D. text1-text2-text3
    text3


Answer : B

Given:

Which action enables the code to compile?

  • A. Replace 2 with static String name;
  • B. Replace 7 with public static void display(String design) {
  • C. Replace 3 with private static void display() {
  • D. Replace 15 with Item.display("Flower");


Answer : A

Given:
and the code fragment:

What is the result?

  • A. Marketing
  • B. Marketing
    Finance
    Technical
  • C. Marketing
    UnDefined
  • D. UnDefined


Answer : A

Given:

What is the result?

  • A. B A D
  • B. D A D
  • C. B A C
  • D. D D D


Answer : A

Given:

What is the result?

  • A. runsruns
  • B. flipsruns
  • C. runsflips
  • D. Compilation fails.
  • E. flipsflips


Answer : B

Given:

Which two method invocations execute? (Choose two.)

  • A. new MyC().m2();
  • B. IFace.m4();
  • C. IFace myClassObj = new MyC();
    myClassObj.m3();
  • D. IFace myClassObj = new MyC();
    myClassObj.m4();
  • E. IFace.m3();
  • F. IFace.m2();


Answer : AE

Given the directory structure:

Given the definition of the Doc class:

Which two are valid definitions of the WordDoc class? (Choose two.)

  • A. package p1.p2;
    public non-sealed class WordDoc extends Doc { }
  • B. package p1;
    public final class WordDoc extends Doc {}
  • C. package p1;
    non-sealed abstract class WordDoc extends Doc {}
  • D. package p1.p2:
    public sealed class WordDoc extends Doc { }
  • E. package p1;
    public class WordDoc extends Doc {}
  • F. package p1;
    public non-sealed class WordDoc extends Doc {}


Answer : BF

Given:

What is the result?

  • A. Compilation fails.
  • B. wTablewChair TableChair
  • C. TableChair TableChair
  • D. A RuntimeException is thrown.
  • E. wTableChair TableChair


Answer : E

Given:
and

Which two should the module-info file include for it to represent the service provider interface? (Choose two.)

  • A. exports com.transport.vehicle.cars;
  • B. provides com.transport.vehicle.cars.impl.CarImpl to com.transport.vehicle.cars.Car;
  • C. requires com.transport.vehicle.cars.Car;
  • D. exports com.transport.vehicle.cars.Car;
  • E. requires com.transport.vehicle.cars;
  • F. exports com.transport.vehicle;
  • G. provides com.transport.vehicle.cars.Car with com.transport.vehicle.cars.impl.CarImpl;


Answer : A, G

Which two code fragments compile? (Choose two.)

  • A.
  • B.
  • C.
  • D.
  • E.
  • F.


Answer : AE

Given the Product class:
and the Shop class:

What is the result?

  • A. Compilation fails.
  • B. Cookie 0.0 2.99
  • C. Cookie 2.99 2.99
  • D. Cookie 3.99 2.99
  • E. An exception is produced at runtime.
  • F. Cookie 0.0 0.0


Answer : B

Given the code fragments:
and:

Which action prints Wagon : 200?

  • A. At line n1, implement the java.io.AutoCloseable interface.
  • B. At line n3, replace Car with LuxuryCar.
  • C. At line n1, implement the java.io.Serializable interface.
  • D. At line n3, replace readObject() with readLine().
  • E. At line n2, in the main method signature, add throws IOException, ClassNotFoundException.
  • F. At line n2, in the main method signature, add throws IOException, ClassCastException.


Answer : C

Given:

What is the result?

  • A. Software Game read error
  • B. Software Game Chess 0
  • C. Software Game Software Game Chess 2
  • D. Software Game Chess 2
  • E. Software Game write error
  • F. Software Game Software Game Chess 0


Answer : C

Given:
Captions.properties file:
user = UserName
Captions_en.properties file:
user = User name (EN)
Captions_US.properties file:
message = User name (US)
Captions_en_US.properties file:
message = User name (EN - US)
and the code fragment:

What is the result?

  • A. User name (EN - US)
  • B. The program throws a MissingResourceException.
  • C. UserName
  • D. User name (EN)
  • E. User name (US)


Answer : D

Given:
and the code fragment:

Which statement is true?

  • A. The program throws ClassCastException.
  • B. The program fails to compile.
  • C. The program throws StockException.
  • D. The program throws OutofStockException.


Answer : D

Page:    1 / 4   
Total 50 questions