New Year Special Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

Oracle 1z0-819 Java SE 11 Developer Exam Practice Test

Page: 1 / 30
Total 296 questions

Java SE 11 Developer Questions and Answers

Question 1

Given the formula to calculate a monthly mortgage payment:

Question # 1

and these declarations:

Question # 1

How can you code the formula?

Options:

A.

m = p * (r * Math.pow(1 + r, n) / (Math.pow(1 + r, n) - 1));

B.

m = p * ((r * Math.pow(1 + r, n) / (Math.pow(1 + r, n)) - 1));

C.

m = p * r * Math.pow(1 + r, n) / Math.pow(1 + r, n) - 1;

D.

m = p * (r * Math.pow(1 + r, n) / Math.pow(1 + r, n) - 1);

Question 2

Given:

Question # 2

What is known about the Sportscar class?

Options:

A.

The Sportscar class is a subclass of Automobile and inherits its methods.

B.

The Sportscar subclass cannot override setTurbo method from the superclass Automobile.

C.

The Sportscar class is a superclass that has more functionality than the Automobile class.

D.

The Sportscar class inherits the setTurbo method from the superclass Automobile.

Question 3

Given this enum declaration:

Question # 3

Examine this code:

System.out.println(Alphabet.getFirstLetter());

What code should be written at line 3 to make this code print A?

Options:

A.

final String getFirstLetter() { return A.toString(); }

B.

static String getFirstLetter() { return Alphabet.values()[1].toString(); }

C.

static String getFirstLetter() { return A.toString(); }

D.

String getFirstLetter() { return A.toString(); }

Question 4

Which two interfaces are considered to be functional interfaces? (Choose two.)

Options:

A.

@FunctionalInterface

interface InterfaceC {

public boolean equals(Object o);

int breed(int x);

int calculate(int x, int y);

}

B.

@FunctionalInterface

interface InterfaceD {

int breed(int x);

}

C.

@FunctionalInterface

interface InterfaceE {

public boolean equals(int i);

int breed(int x);

}

D.

interface InterfaceA {

int GERM = 13;

public default int getGERM() { return GERM; }

}

E.

interface InterfaceB {

int GERM = 13;

public default int getGERM() { return get(); }

private int get() { return GERM; }

public boolean equals(Object o);

int breed(int x);

Question 5

Given:

Question # 5

Which two lines can replace line 1 so that the Y class compiles? (Choose two.)

Options:

A.

map.forEach((k, v) -> set(v)));

B.

set(map.values());

C.

super.set(List map)

D.

super.set(map.values());

E.

set(map)

Question 6

Given:

Question # 6

What action ensures successful compilation?

Options:

A.

Replace public Color(int c) with private Color(int c).

B.

Replace int c; with private int c;.

C.

Replace int c; with private final int c;.

D.

Replace enum Color implements Serializable with public enum Color.

E.

Replace enum Color with public enum Color.

Question 7

Given:

Question # 7

Which two are correct? (Choose two.)

Question # 7

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 8

Given:

Question # 8

What is the result?

Options:

A.

Take extra care

B.

The program prints nothing.

C.

Take extra care

Take extra care

D.

An exception is thrown at runtime

Question 9

Given an application with a main module that has this module-info.java file:

Question # 9

Which two are true? (Choose two.)

Options:

A.

A module providing an implementation of country.CountryDetails can be compiled and added without recompiling the main module.

B.

A module providing an implementation of country.CountryDetails must have a requires main; directive in its module-info.java file.

C.

An implementation of country.countryDetails can be added to the main module.

D.

To compile without an error, the application must have at least one module in the module source path that provides an implementation of country.CountryDetails.

E.

To run without an error, the application must have at least one module in the module path that provides an implementation of country.CountryDetails.

Question 10

Given these two classes:

Question # 10

Question # 10

And given this fragment:

Question # 10

Which describes the fragment?

Options:

A.

It throws IllegalMonitorStateException.

B.

It is subject to deadlock.

C.

It is subject to livelock.

D.

The code does not compile.

Question 11

Given:

Question # 11

What is the result?

Options:

A.

compilation error

B.

0 5

C.

6 13

D.

5 12

Question 12

Given:

Question # 12

Which option should you choose to enable the code to print Something happened?

Options:

A.

Add extends GeneralException on line 1.

Add extends Exception on line 2.

B.

Add extends SpecificException on line 1.

Add extends GeneralException on line 2.

C.

Add extends Exception on line 1.

Add extends Exception on line 2.

D.

Add extends Exception on line 1.

Add extends GeneralException on line 2.

Question 13

Given:

Question # 13

What is the result?

Options:

A.

6910 3

B.

10126 3

C.

3

D.

6104 3

Question 14

Given the code fragment:

Question # 14

Which statement at line 1 will print Ping Pong?

A)

Question # 14

B)

Question # 14

C)

Question # 14

D)

Question # 14

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 15

Given the code fragment:

Question # 15

What is the result?

Options:

A.

EUR -> 0.84

GBP -> 0.75

USD -> 1.00

CNY -> 6.42

B.

The compilation fails.

C.

CNY -> 6.42

EUR -> 0.84

GBP -> 0.75

USD -> 1.00

D.

USD -> 1.00

GBP -> 0.75

EUR -> 0.84

CNY -> 6.42

Question 16

Given:

Question # 16

Which would cause s to be AQCD?

Options:

A.

s.replace(s.indexOf(“A”), s.indexOf(“C”), “Q”);

B.

s.replace(s.indexOf(“B”), s.indexOf(“C”), “Q”);

C.

s.replace(s.indexOf(“B”), s.indexOf(“B”), “Q”);

D.

s.replace(s.indexOf(“A”), s.indexOf(“B”), “Q”);

Question 17

Given:

Question # 17

Which two method implementations are correct, when inserted independently in line 1? (Choose two.)

Question # 17

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 18

Given the content:

Question # 18

What Is the result?

A)

Question # 18

B)

Question # 18

C)

Question # 18

D)

Question # 18

E)

User Username

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option

Question 19

Given the code fragment:

Which two code snippets inserted independently inside print method print Mondial: domainmodal?

Options:

A.

prefix + name

B.

prefix + getName

C.

new Main (} .prefix + new Main().name

D.

prefix + Main, name

E.

Main.prefix + Main.name

F.

Main.prefix + Main.getName()

Question 20

Question # 20

Which is true?

Options:

A.

Code compiles but throws a runtime exception when run.

B.

It prints 666.

C.

The code compiles and runs successfully but with a wrong answer (i.e., a bug).

D.

The code does not compile successfully.

Question 21

Given:

Question # 21

What is the result?

Options:

A.

nothing

B.

It fails to compile.

C.

0

D.

A java.lang.IllegalArgumentException is thrown.

E.

10

Question 22

Given:

Question # 22

Which two independent changes will make the Main class compile? (Choose two.)

Options:

A.

Move the entire Student class declaration to a separate Java file, Student.java.

B.

Change line 2 to public Student(String classname).

C.

Change line 1 to public class Student {.

D.

Change line 3 to Student student = new Student(“Biology”);.

E.

Change line 1 to static class Student {.

Question 23

Given the code fragment:

Question # 23

What is the result?

Options:

A.

ab cd ef

B.

An ArrayIndexOutOfBoundsException is thrown at runtime.

C.

The compilation fails.

D.

abc def

E.

ad be cf

Question 24

Given the code fragment:

Question # 24

What change on line 1 will make this code compile?

Options:

A.

Add catch (L |N e).

B.

Add catch (L |M N e).

C.

Add catch (L e).

D.

Add catch (N | L | M e).

E.

Add catch (M |L e).

Question 25

Which two describe reasons to modularize the JDK? (Choose two.)

Options:

A.

easier to understand the Java language

B.

improves security and maintainability

C.

easier to expose implementation details

D.

improves application robustness

E.

easier to build a custom runtime linking application modules and JDK modules

Question 26

Given:

Question # 26

Which two allow a.Main to allocate a new Person? (Choose two.)

Options:

A.

In Line 1, change the access modifier to privateprivate Person() {

B.

In Line 1, change the access modifier to publicpublic Person() {

C.

In Line 2, add extends Person to the Main classpublic class Main extends Person {and change Line 3 to create a new Main objectPerson person = new Main();

D.

In Line 2, change the access modifier to protectedprotected class Main {

E.

In Line 1, remove the access modifierPerson() {

Question 27

Given:

Question # 27

What is the result?

Options:

A.

null

B.

nothing

C.

It fails to compile.

D.

java.lang.IllegalAccessException is thrown.

E.

Student

Question 28

Which two commands are used to identify class and module dependencies? (Choose two.)

Options:

A.

jmod describe

B.

java Hello.java

C.

jdeps --list-deps

D.

jar --show-module-resolution

E.

java --show-module-resolution

Question 29

Given:

Question # 29

Which two changes need to be made to make this class compile? (Choose two.)

Options:

A.

Change Line 1 to an abstract class:public abstract class API {

B.

Change Line 2 access modifier to protected:protected void checkValue(Object value)throws IllegalArgumentException;

C.

Change Line 1 to a class:public class API {

D.

Change Line 1 to extend java.lang.AutoCloseable:public interface API extends AutoCloseable {

E.

Change Line 2 to an abstract method:public abstract void checkValue(Object value)throws IllegalArgumentException;

Question 30

Given the declaration:

Question # 30

Which two annotations may be applied at Loc1 in the code fragment? (Choose two.)

Options:

A.

@Resource({“Customer1”, “Customer2”})

B.

@Resource(value={{}})

C.

@Resource

D.

@Resource(“Customer1”)

E.

@Resource()

Question 31

Given the code fragment:

Question # 31

What is the result?

Options:

A.

1

B.

The compilation fails at line

C.

10

D.

The compilation fails at line 16.

E.

The compilation fails at line 13.

Question 32

Given:

Question # 32

What is the result?

Options:

A.

9

B.

An exception is thrown at runtime.

C.

3

D.

6

Question 33

Given:

Question # 33

You wants to make the reduction operation parallelized.

Which two modifications will accomplish this?

Options:

A.

Replace line 1 with int sum = numbers. Stream (). Interate (0, a -> a+1. Reduce (0, (n m) -> n+m);

B.

Replace line 1with int sum = numbers. ParallelStream ( ). Reduce (0, (n, m ) -> n + m);

C.

Replace line 1 with int sum = numbers. Parallel ( ). Stream ( ). Reduce (0, (n, m ) -> n + m);

D.

Replace line 1with int sum = number. Stream ( ) . flatMap (a -> a) .reduce (0, (n, m) -> n +m );

E.

Replace line 1with int sum = number.stream. parallel ( ). Reduce (0, (n, m) -> n + m);

Question 34

Given:

jdeps -jdkinternals C:\workspace4\SimpleSecurity\jar\classes.jar

Which describes the expected output?

Options:

A.

jdeps lists the module dependencies and the package names of all referenced JDK internal APIs. If any are found, the suggested replacements are output in the console.

B.

jdeps outputs an error message that the -jdkinternals option requires either the -summary or the - verbose options to output to the console.

C.

The -jdkinternals option analyzes all classes in the .jar and prints all class-level dependencies.

D.

The -jdkinternals option analyzes all classes in the .jar for class-level dependencies on JDK internal APIs. If any are found, the results with suggested replacements are output in the console.

Question 35

Given:

Question # 35

What code inserted into class C would allow it to compile?

Options:

A.

public void x() { }

public void z() { }

B.

public void x() { }

protected void y() { super.y(); }

public void z() { }

C.

void x() { }

public void y() { }

public void z() { }

D.

void x() { super.y(); }

public void z() { }

E.

void x() { }

public void z() { }

Question 36

Given:

Question # 36

Which code, when inserted at one or more marked positions, would allow classes B and C to compile?

Options:

A.

@Override // position 3void x () {} // position 3@Override // position 3public void z() { } // position 3

B.

@Override // position 2public void z() { } // position 3

C.

implements A // position 1@Override // position 2

D.

public void z() { } // position 3

Question 37

Given the code fragment:

Question # 37

What is the result?

Options:

A.

01

B.

0

C.

1

D.

The program prints nothing.

E.

It prints 1 in the infinite loop.

Question 38

Given:

Question # 38

What is the result?

Options:

A.

[0,0] = Red[0,1] = White[1,0] = Black[1,1] = Blue[2,0] = Yellow[2,1] = Green[3,0] = Violet

B.

[0,0] = Red[1,0] = Black[2,0] = Blue

C.

java.lang.ArrayIndexOutOfBoundsException thrown

D.

[0,0] = Red[0,1] = White[1,0] = Black[2,0] = Blue[2,1] = Yellow[2,2] = Green[2,3] = Violet

Page: 1 / 30
Total 296 questions