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

Oracle 1z0-819 Dumps

Page: 1 / 10
Total 257 questions

Java SE 11 Developer Questions and Answers

Question 1

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

Question 2

Given the code fragment:

What is the result?

Options:

A.

An ArrayIndexOutofBoundsException is thrown at runtime.

B.

The compilation fails.

C.

gh ij kl

D.

gj hk il

E.

ghi jkl

Question 3

Given:

Which annotation should be used to remove warnings from compilation?

Options:

A.

@SuppressWarnings on the main and print methods

B.

@SuppressWarnings(“unchecked”) on main and @SafeVarargs on the print method

C.

@SuppressWarnings(“rawtypes”) on main and @SafeVarargs on the print method

D.

@SuppressWarnings(“all”) on the main and print methods

Question 4

Given:

Which expression when added at line 1 will produce the output of 1.17?

Options:

A.

float z = (float)(Math.round((float)x/y*100)/100);

B.

float z = Math.round((int)(x/y),2);

C.

float z = Math.round((float)x/y,2);

D.

float z = Math.round((float)x/y*100)/(float)100;

Question 5

Given:

and

checkQuality(QUALITY.A);

and

Which code fragment can be inserted into the switch statement to print Best?

Options:

A.

QUALITY.A.ValueOf()

B.

A

C.

A.toString()

D.

QUALITY.A

Question 6

Given:

Which two codes, independently, can be inserted in line to 1 compile?

Options:

A.

Abacus aba = (int m, int n) -> { m * n };

B.

Abacus aba = (int e, int f) -> { return e * f; };

C.

Abacus aba = (a, b) -> a * b;

D.

Abacus aba = v, w -> x * y;

E.

Abacus aba = (int i, j) -> ( return i * j; };

Question 7

There is a copyServiceAPI that has the org.copyservice. spi. Copy interface

To use this service in a module, which module- info.java would be correct?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 8

Which code fragment compiles?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 9

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!

Question 10

Analyze the code:

Which two options can you insert inside println method to produce Global:namescope? (Choose two.)

Options:

A.

Test.prefix+Test.name

B.

new Test().prefix+new Test().name

C.

Test.prefix+Test.getName()

D.

Test.getName+prefix

E.

prefix+Test.name

F.

prefix+name

Question 11

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!

Question 12

Which two statements are correct about try blocks? (Choose two.)

Options:

A.

A try block can have more than one catch block.

B.

A finally block in a try-with-resources statement executes before the resources declared are closed.

C.

A finally block must be immediately placed after the try or catch blocks.

D.

A try block must have a catch block and a finally block.

E.

catch blocks must be ordered from generic to specific exception types.

Question 13

Given:

What is the output?

Options:

A.

A compilation error is thrown.

B.

Message from Copier: Attempt00

C.

Message from Abstract Copier: Attempt00

D.

A runtime error is thrown.

Question 14

Which statement about a functional interface is true?

Options:

A.

It must be defined with the public access modifier.

B.

It must be annotated with @FunctionalInterface.

C.

It is declared with a single abstract method.

D.

It is declared with a single default method.

E.

It cannot have any private methods and static methods.

Question 15

Given:

and:

Which code, when inserted on line 10, prints the number of unique localities from the roster list?

Options:

A.

.map(Employee::getLocality)

.distinct()

.count();

B.

map(e −> e.getLocality())

.count();

C.

.map(e −> e.getLocality())

.collect(Collectors.toSet())

.count();

D.

.filter(Employee::getLocality)

.distinct()

.count();

Question 16

Given:

What is the result?

Options:

A.

It throws a runtime exception.

B.

Value of Euler = 2.71828

C.

The code does not compile.

D.

Value of Euler = “2.71828”

Question 17

Given the content:

What Is the result?

A)

B)

C)

D)

E)

User Username

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option

Question 18

Given:

Which two are correct? (Choose two.)

Options:

A.

The output will be exactly 2 1 3 4 5.

B.

The program prints 1 4 2 3, but the order is unpredictable.

C.

Replacing forEach() with forEachOrdered(), the program prints 2 1 3 4 5, but the order is unpredictable.

D.

Replacing forEach() with forEachOrdered(), the program prints 1 2 3 4 5.

E.

Replacing forEach() with forEachOrdered(), the program prints 2 1 3 4 5.

Question 19

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

Question 20

Which three annotation uses are valid? (Choose three.)

Options:

A.

Function func = (@NonNull x) −> x.toUpperCase();

B.

var v = “Hello” + (@Interned) “World”

C.

Function func = (var @NonNull x) −> x.toUpperCase();

D.

Function func = (@NonNull var x) −> x.toUpperCase();

E.

var myString = (@NonNull String) str;

F.

var obj = new @Interned MyObject();

Question 21

Given the code fragment:

Which two statement inserted independently at line 1 enable this code to print PRRT?

Options:

A.

i—;

B.

continue b;

C.

break b;

D.

j--;

E.

continue a;

F.

break a ;

Question 22

Given the code fragment:

Which can replace line 2?

Options:

A.

UnaryOperator u = (int i) -> i * 2;

B.

UnaryOperator u = (var i) -> (i * 2);

C.

UnaryOperator u = var i -> { return i * 2; };

D.

UnaryOperator u = i -> { return i * 2);

Question 23

Given:

What is the result?

Options:

A.

abyssinian

oxicat

korat

laperm

bengal

sphynx

B.

abyssinian

bengal

korat

laperm

oxicat

sphynx

C.

sphynx

oxicat

laperm

korat

bengal

abyssinian

D.

nothing

Question 24

Given:

What is the result?

Options:

A.

nothing

B.

0

C.

10

D.

0 4 9

Question 25

Which command line runs the main class com.acme.Main from the module com.example?

Options:

A.

java --module-path mods com.example/com.acme.Main

B.

java –classpath com.example.jar com.acme.Main

C.

java --module-path mods -m com.example/com.acme.Main

D.

java -classpath com.example.jar –m com.example/com.acme.Main

Question 26

Given:

Assume the file on path does not exist. What is the result?

Options:

A.

The compilation fails.

B.

/u01/work/filestore.txt is not deleted.

C.

Exception

D.

/u01/work/filestore.txt is deleted.

Question 27

Given:

After which line can we insert assert i < 0 || values[i] <= values[i + 1]; to verify that the

values array is partially sorted?

Options:

A.

after line 8

B.

after line 6

C.

after line 5

D.

after line 10

Question 28

Given:

You want to obtain the Filechannel object on line 1.

Which code fragment will accomplish this?

A)

B)

C)

D)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 29

Given:

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 30

Given this requirement:

Module vehicle depends on module part and makes its com.vehicle package available for all other modules.

Which module-info.java declaration meets the requirement?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 31

Given:

What is the result?

Options:

A.

nothing

B.

It fails to compile.

C.

0

D.

A java.lang.IllegalArgumentException is thrown.

E.

10

Question 32

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.

Question 33

Given:

What is the result?

Options:

A.

NullPointerException is thrown at line 4.

B.

NullPointerException is thrown at line 10.

C.

A compilation error occurs.

D.

Hello

Question 34

Given:

What is the output?

Options:

A.

300

B.

Exception

C.

200

D.

100

Question 35

A bookstore's sales are represented by a list of Sale objects populated with the name of the customer and the books they purchased.

public class Sale {

private String customer;

private List items;

// constructor, setters and getters not shown

}

public class Book {

private String name;

private double price;

// constructor, setters and getters not shown

}

Given a list of Sale objects, tList, which code fragment creates a list of total sales for each customer in ascending order?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 36

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

Question 37

Given:

What is the output?

Options:

A.

1 2 [1, 2, 3, four] 3 four

B.

1 2 [1, 2, 3, 4] 3 4

C.

1 2 [1, 2, 3, 4] 3 four

D.

1 2 [1, 2, 3, four] 3 4

Question 38

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.

Page: 1 / 10
Total 257 questions