Labour Day Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exams65

Java SE 11 Developer Question and Answers

Java SE 11 Developer

Last Update Apr 27, 2024
Total Questions : 257

We are offering FREE 1z0-819 Oracle exam questions. All you do is to just go and sign up. Give your details, prepare 1z0-819 free exam questions and then go for complete pool of Java SE 11 Developer test questions that will help you more.

1z0-819 pdf

1z0-819 PDF

$35  $99.99
1z0-819 Engine

1z0-819 Testing Engine

$42  $119.99
1z0-819 PDF + Engine

1z0-819 PDF + Testing Engine

$56  $159.99
Questions 1

You are working on a functional bug in a tool used by your development organization. In your investigation, you find that the tool is executed with a security policy file containing this grant.

What action should you take?

Options:

A.  

Nothing, because it is an internal tool and not exposed to the public.

B.  

Remove the grant because it is excessive.

C.  

Nothing, because it is not related to the bug you are investigating.

D.  

File a security bug against the tool referencing the excessive permission granted.

E.  

Nothing, because listing just the required permissions would be an ongoing maintenance challenge.

Discussion 0
Questions 2

Given:

What needs to change to make these classes compile and still handle all types of Interface Worker?

Options:

A.  

Replace Line 3 with public void addProcess (Worker w) {.

B.  

Replace Line 1 with public class Main extends Thread {.

C.  

Replace Line 2 with private List processes = new ArrayList<>();.

D.  

Replace Line 3 with public void addProcess(T w) {.

Discussion 0
Questions 3

Which code fragment prints 100 random numbers?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 4

Given the code fragment:

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.

Discussion 0
Questions 5

Given:

What is the result?

Options:

A.  

nothing

B.  

It fails to compile.

C.  

0

D.  

A java.lang.IllegalArgumentException is thrown.

E.  

10

Discussion 0
Questions 6

Which interface in the java.util.function package can return a primitive type?

Options:

A.  

ToDoubleFunction

B.  

Supplier

C.  

BiFunction

D.  

LongConsumer

Discussion 0
Questions 7

Given the code fragment:

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).

Discussion 0
Questions 8

Which method throws an exception for not-a-number and infinite input values?

A)

B)

C)

D)

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 9

Given this enum declaration:

Examine this code:

System.out.println(Letter.values()[1]);

What code should be written at line 5 for this code to print 200?

Options:

A.  

public String toString() { return String.valueOf(ALPH

A.  

v); }

B.  

public String toString() { return String.valueOf(Letter.values()[1]); }

C.  

public String toString() { return String.valueOf(v); }

D.  

String toString() { return “200”; }

Discussion 0
Questions 10

Given:

What is the result?

Options:

A.  

Dr. Who

B.  

Dr. Null

C.  

An exception is thrown at runtime.

D.  

null

Discussion 0
Questions 11

Which code fragment does a service use to load the service provider with a Print interface?

Options:

A.  

private Print print = com.service.Provider.getInstance();

B.  

private java.util.ServiceLoader loader = ServiceLoader.load (Print.class);

C.  

private java.util.ServiceLoader loader = new java.util.ServiceLoader<> ();

D.  

private Print print = new com.service.Provider.PrintImpl();

Discussion 0
Questions 12

Given:

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() {

Discussion 0
Questions 13

Given:

/code/a/Test.java

containing:

and

/code/b/Best.java

containing:

package b;

public class Best { }

Which is the valid way to generate bytecode for all classes?

Options:

A.  

java /code/a/Test.java

B.  

javac –d /code /code/a/Test

C.  

java /code/a/Test.java /code/b/Best.java

D.  

java –cp /code a.Test

E.  

javac –d /code /code/a/Test.java /code/b/Best.java

F.  

javac –d /code /code/a/Test.java

Discussion 0
Questions 14

Which code fragment compiles?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 15

Given:

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

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

E.  

Option E

Discussion 0
Questions 16

Your organization makes mlib.jar available to your cloud customers. While working on a code cleanup project for mlib.jar, you see this method by customers:

What security measures should be added to this method so that it meets the requirements for a customer accessible method?

Options:

A.  

B.  

Create a method that validates the hostName and portNumber parameters before opening the socket.

C.  

Make enableService private.

D.  

Enclose the call to new Socket In an AccessController.doPrivileged block.

Discussion 0
Questions 17

What change will cause the code to compile successfully?

Options:

A.  

Insert PriceChecker (?) prod on line 1.

B.  

Insert PriceChecker <> prod on line 1.

C.  

Insert PriceChecker prod on line 1.

D.  

Insert PriceChecker prod on line 1.

Discussion 0
Questions 18

Given the code fragment:

Path source = Paths.get(“/repo/a/a.txt”);

Path destination = Paths.get(“/repo”);

Files.move(source, destination); // line 1

Files.delete (source); // line 2

Assuming the source file and destination folder exist, what Is the result?

Options:

A.  

A java.nio.file.FileAlreadyExistsException is thrown on line 1.

B.  

A java.nio.file.NoSuchFileException is thrown on line 2.

C.  

A copy of /repo/a/a.txt is moved to the /repo directory and /repo/a/a.txt is deleted.

D.  

a.txt is renamed repo.

Discussion 0
Questions 19

Which three initialization statements are correct? (Choose three.)

Options:

A.  

int[][][] e = {{1,1,1},{2,2,2}};

B.  

short sh = (short)’A’;

C.  

float x = 1f;

D.  

byte b = 10;

char c = b;

E.  

String contact# = “(+2) (999) (232)”;

F.  

int x = 12_34;

G.  

boolean false = (4 != 4);

Discussion 0
Questions 20

Given:

What is the output?

Options:

A.  

:APPLE:ORANGE:BANANA

appleorangebanana

B.  

:APPLE:ORANGE:BANANA

C.  

APPLE:apple ORANGE:orange BANANA:banana

D.  

appleorangebanana

:APPLE:ORANGE:BANANA

E.  

apple:APPLE orange:ORANGE banana:BANANA

Discussion 0
Questions 21

Which two statements independently compile? (Choose two.)

Options:

A.  

List list = new ArrayList();

B.  

List list = new ArrayList();

C.  

List list = new ArrayList();

D.  

List list = new ArrayList();

E.  

List list = new ArrayList();

Discussion 0
Questions 22

Given:

executed with this command:

java Main one two three

What is the result?

Options:

A.  

0). one

B.  

0). one1). two2). three

C.  

The compilation fails.

D.  

It creates an infinite loop printing:0). one1). two1). two...

E.  

A java.lang.NullPointerException is thrown.

Discussion 0
Questions 23

Given:

What is the result?

Options:

A.  

Map: 0 Keys: 0 Values: 0

B.  

The compilation fails.

C.  

Map: 4 Keys: 4 Values: 4

D.  

Map: 4 Keys: 0 Values: 0

E.  

Map: 0 Keys: 4 Values: 4

Discussion 0
Questions 24

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.

Discussion 0
Questions 25

Given the formula to calculate a monthly mortgage payment:

and these declarations:

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);

Discussion 0
Questions 26

Given:

Why does D cause a compilation error?

Options:

A.  

D inherits a() only from C.

B.  

D inherits a() from B and C but the return types are incompatible.

C.  

D extends more than one interface.

D.  

D does not define any method.

Discussion 0
Questions 27

What is the result?

Options:

A.  

357

B.  

35

C.  

235

D.  

2357

E.  

An ArrayIndexOutOfBoundsException is thrown at runtime.

Discussion 0
Questions 28

Given:

When run and all three files exist, what is the state of each reader on Line 1?

Options:

A.  

All three readers are still open.

B.  

All three readers have been closed.

C.  

The compilation fails.

D.  

Only reader1 has been closed.

Discussion 0
Questions 29

Given:

How many LocalDate objects are created in this example?

Options:

A.  

2

B.  

3

C.  

4

D.  

5

Discussion 0
Questions 30

Given:

What is the result?

Options:

A.  

null

B.  

nothing

C.  

It fails to compile.

D.  

java.lang.IllegalAccessException is thrown.

E.  

Student

Discussion 0
Questions 31

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

Discussion 0
Questions 32

Given:

Which three are true? (Choose three.)

Options:

A.  

b1.foo(c) prints Bonjour le monde!

B.  

f1.foo(c) prints Hello world!

C.  

f1.foo(c) prints Olá Mundo!

D.  

b1.foo(c) prints Hello world!

E.  

f2.foo(c) prints Olá Mundo!

F.  

b1.foo(c) prints Olá Mundo!

G.  

f2.foo(c) prints Bonjour le monde!

Discussion 0
Questions 33

Given:

What is the output?

Options:

A.  

Hello world!Bonjour le monde!

B.  

Hello world!Hello world!

C.  

Bonjour le monde!Hello world!

D.  

Bonjour le monde!Bonjour le monde!

Discussion 0
Questions 34

Which code is correct?

Options:

A.  

Runnable r = “Message” −> System.out.println();

B.  

Runnable r = () −> System.out::print;

C.  

Runnable r = () -> {System.out.println(“Message”);};

D.  

Runnable r = −> System.out.println(“Message”);

E.  

Runnable r = {System.out.println(“Message”)};

Discussion 0
Questions 35

Given the code fragment:

Which two code snippets inserted independently inside println method print Mondial:domainmodel? (Choose two.)

Options:

A.  

Main.prefix + Main.name

B.  

prefix + getName

C.  

Main.prefix + Main.getName()

D.  

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

E.  

prefix + name

F.  

prefix + Main.name

Discussion 0
Questions 36

Examine these module declarations:

Which two statements are correct? (Choose two.)

Options:

A.  

The ServiceProvider module is the only module that, at run time, can provide the com.example.api API.

B.  

The placement of the com.example.api API in a separate module, ServiceAPI, makes it easy to install multiple provider modules.

C.  

The Consumer module should require the ServiceProvider module.

D.  

The ServiceProvider module should export the com.myimpl package.

E.  

The ServiceProvider module does not know the identity of a module (such as Consumer) that uses the

com.example.api API.

Discussion 0
Questions 37

Given:

Assuming that this code compiles correctly, which three statements are true? (Choose three.)

Options:

A.  

B cannot be abstract.

B.  

B is a subtype of A.

C.  

A cannot be abstract.

D.  

A cannot be final.

E.  

B cannot be final.

F.  

A is a subtype of B.

Discussion 0
Questions 38

Given the code fragment:

What is the output?

Options:

A.  

The compilation fails.

B.  

[-1, -2, -3]

C.  

[-3, -2, -1]

D.  

A runtime exception is thrown.

Discussion 0