Weekend Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: dumps65

Oracle 1z0-819 Dumps

Page: 1 / 26
Total 257 questions

Java SE 11 Developer Questions and Answers

Question 1

Given:

as

What is the result?

A)

as

B)

as

C)

as

D)

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 2

Given:

String originalPath = “data\\projects\\a-project\\..\\..\\another-project”;

Path path = Paths.get(originalPath);

System.out.print(path.normalize());

What is the result?

Options:

A.

data\another-project

B.

data\projects\a-project\another-project

C.

data\\projects\\a-project\\..\\..\\another-project

D.

data\projects\a-project\..\..\another-project

Question 3

Which code fragment prints 100 random numbers?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 4

Given:

as

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 5

Which interface in the java.util.function package will return a void return type?

Options:

A.

Supplier

B.

Predicate

C.

Function

D.

Consumer

Question 6

Given:

as

And the command:

java Main Helloworld

What is the result ?

Options:

A.

Input: Echo:

B.

Input: Helloworld Echo: Helloworld

C.

Input:

Then block until any input comes from System.in.

D.

Input:

Echo: Helloworld

E.

A NullPointerException is thrown at run time.

Question 7

Given:

as

What is the correct definition of the JsonField annotation that makes the Point class compile?

A)

as

B)

as

C)

as

Options:

A.

Option A

B.

Option B

C.

Option C

Question 8

Given:

as

What code must you insert on Line 1 to enable the code to print Hello world?

Options:

A.

Hello.Greeting myG = new Hello.Greeting() myG.sayHi();

B.

Hello myH = new Hello();

Hello.Greeting myG = myH.new Greeting();

myG.sayHi();

C.

Hello myH = new Hello();

Hello.Greeting myG = myH.new Hello.Greeting();

myG.sayHi();

D.

Hello myH = new Hello(); Greeting myG = new Greeting(); myG.sayHi ();

Question 9

Given:

as

Which two are correct? (Choose two.)

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 10

Given:

as

What is the expected result of javac?

Options:

A.

javac fails to compile the class and prints the error message, C:\workspace4\Mycar.java:1:error: package java does not exist

B.

javac compiles Mycar.java without errors or warnings.

C.

javac fails to compile the class and prints the error message, C:\workspace4\Mycar.java:1:error: expected import java.lang

D.

javac fails to compile the class and prints the error message, Error: Could not find or load main class Mycar.class

Question 11

Which is the correct order of possible statements in the structure of a Java class file?

Options:

A.

class, package, import

B.

package, import, class

C.

import, package, class

D.

package, class, import

E.

import, class, package

Question 12

Given:

as

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:

as

What is required to make the Foo class thread safe?

Options:

A.

No change is required.

B.

Make the declaration of lock static.

C.

Replace the lock constructor call with new ReentrantLock (true).

D.

Move the declaration of lock inside the foo method.

Question 14

A company has an existing sales application using a Java 8 jar file containing packages:

com.company.customer;

com.company.customer.orders;

com.company.customer.info;

com.company.sales;

com.company.sales.leads;

com.company.sales.closed;

com.company.orders;

com.company.orders.pending;

com.company.orders.shipped.

To modularize this jar file into three modules, customer, sales, and orders, which module-info.java would be correct?

A)

as

B)

as

C)

as

D)

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 15

Given:

as

Which statement is true?

Options:

A.

Class Tester does not need to import java.time.LocalDate because it is already visible to members of the package test.

B.

All classes from the package java.time. are loaded for the class Diary.

C.

Only LocalDate class from java.time package is loaded.

D.

Tester must import java.time.LocalDate in order to compile.

Question 16

Given:

as

What is the result?

Options:

A.

nothing

B.

It fails to compile.

C.

0

D.

A java.lang.IllegalArgumentException is thrown.

E.

10

Question 17

Given:

as

What must be added in line 1 to compile this class?

Options:

A.

catch(IOException e) { }

B.

catch(FileNotFoundException | IndexOutOfBoundsException e) { }

C.

catch(FileNotFoundException | IOException e) { }

D.

catch(IndexOutOfBoundsException e) { }catch(FileNotFoundException e) { }

E.

catch(FileNotFoundException e) { }catch(IndexOutOfBoundsException e) { }

Question 18

Assuming the Widget class has a getPrice method, this code does not compile:

as

Which two statements, independently, would allow this code to compile? (Choose two.)

Options:

A.

Replace line 5 with widgetStream.filter(a −> ((Widget)a).getPrice() > 20.00).

B.

Replace line 1 with List widgetStream = widgets.stream();.

C.

Replace line 5 with widgetStream.filter((Widget a) −> a.getPrice() > 20.00).

D.

Replace line 4 with Stream widgetStream = widgets.stream();.

Question 19

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 20

Given:

as

It is required that if p instanceof Pair then p.isValid() returns true.

Which is the smallest set of visibility changes to insure this requirement is met?

Options:

A.

setLeft and setRight must be protected.

B.

left and right must be private.

C.

isValid must be public.

D.

left, right, setLeft, and setRight must be private.

Question 21

Which two safely validate inputs? (Choose two.)

Options:

A.

Delegate numeric range checking of values to the database.

B.

Accept only valid characters and input values.

C.

Use trusted domain-specific libraries to validate inputs.

D.

Assume inputs have already been validated.

E.

Modify the input values, as needed, to pass validation.

Question 22

Given:

as

Which two statements are true if the method is added to Bar? (Choose two.)

Options:

A.

public Collection foo(Collection arg) { ... } overrides Foo.foo.

B.

public Collection foo(Stream arg) { ... } overloads Foo.foo.

C.

public List foo(Collection arg) { ... } overrides Foo.foo.

D.

public Collection foo(Collection arg) { ... } overloads Foo.foo.

E.

public Collection bar(Collection arg) { ... } overloads Foo.foo.

F.

public Iterable foo(Collection arg) { ... } overrides Foo.foo.

Question 23

Given:

as

What is the result?

Options:

A.

6910 3

B.

10126 3

C.

3

D.

6104 3

Question 24

Which code fragment compiles?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 25

Given:

as

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 26

Given TripleThis.java:

as

Compiling TripleThis.java gives this compiler warning:

Note: TripleThis.java uses unchecked or unsafe operations.

Which two replacements done together remove this compiler warning?

Options:

A.

Replace line 9 with function tripler = x-> - { return (Integer) X * 3 ; }.

B.

Replace line 12 with public static void printValue function f, int num) {.

C.

Replace line 12 with public static int printValue function, f, T num {.

D.

Replace line 12 with public static void printValue (Function f, T num ) {,

E.

Replace line 9 with function, Integer> = X -> { return (integer) x * 3; }.

Question 27

as

Given:

Which statement on line 1 enables this code to compile?

Options:

A.

Consumer function = (String f) -> (System.out.println(f);};

B.

Supplier function = () -> fruits.get (0);

C.

Predicate function = a -> a.equals("banana");

D.

Function function = x -> x.substring(0,2);

Question 28

Given:

as

What is the result?

Options:

A.

The compilation fails.

B.

1.99,2.99,0

C.

1.99,2.99,0.0

D.

1.99,2.99

Question 29

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

Options:

A.

ToDoubleFunction

B.

Supplier

C.

BiFunction

D.

LongConsumer

Question 30

Given:

var data = new ArrayList<>();

data.add(“Peter”);

data.add(30);

data.add(“Market Road”);

data.set(1, 25);

data.remove(2);

data.set(3, 1000L);

System.out.print(data);

What is the output?

Options:

A.

[Market Road, 1000]

B.

[Peter, 30, Market Road]

C.

[Peter, 25, null, 1000]

D.

An exception is thrown at run time.

Question 31

Given the code fragment:

as

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 32

Given the content:

as

What Is the result?

A)

as

B)

as

C)

as

D)

as

E)

User Username

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option

Question 33

Given:

as

What is the result?

Options:

A.

An indexOutofBoundsException is thrown at runtime.

B.

At once 0

C.

Hat at store 4

D.

At once 1

E.

Hat at store 1

Question 34

as

A)

as

B)

as

C)

as

D)

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 35

Given:

as

Which is true about line 1?

Options:

A.

If the value is not present, a NoSuchElementException is thrown at run time.

B.

It always executes the System.out::print statement.

C.

If the value is not present, a NullPointerException is thrown at run time.

D.

If the value is not present, nothing is done.

Question 36

Given:

as

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 37

Analyze the code:

as

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 38

Given:

as

What is the result?

Options:

A.

is it 1

B.

An IndexOutOfBoundsException is thrown at runtime.

C.

is it 0

D.

this is it 2

E.

this is it 3

Page: 1 / 26
Total 257 questions