11.11 Special Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: scxmas70

1z0-819 Exam Dumps - Java SE 11 Developer

Question # 4

Given the code fragment:

Path currentFile = Paths.get(“/scratch/exam/temp.txt”);

Path outputFile = Paths get(“/scratch/exam/new.txt”);

Path directory = Paths.get(“/scratch/”);

Files.copy(currentFile, outputFile);

Files.copy(outputFile, directory);

Files.delete (outputFile);

The /scratch/exam/temp.txt file exists. The /scratch/exam/new.txt and /scratch/new.txt files do not exist.

What is the result?

A.

/scratch/exam/new.txt and /scratch/new.txt are deleted.

B.

The program throws a FileaAlreadyExistsException.

C.

The program throws a NoSuchFileException.

D.

A copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.

Full Access
Question # 5

What change will cause the code to compile successfully?

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.

Full Access
Question # 6

Given the code fragment:

What is the result?

A.

A java.lang, UnsupportedOperationException is thrown.

B.

True

C.

False

D.

A java.lang.NullPointerException is thrown.

Full Access
Question # 7

Given the code fragment:

What is the result?

A.

23

B.

12

C.

123

D.

13

Full Access
Question # 8

Given:

What is the result?

A.

The compilation fails.

B.

abdf

C.

abd

D.

adf

E.

abcd

Full Access
Question # 9

Given:

Why does D cause a compilation error?

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.

Full Access
Question # 10

Given:

What is the output?

A.

Hello world!Bonjour le monde!

B.

Hello world!Hello world!

C.

Bonjour le monde!Hello world!

D.

Bonjour le monde!Bonjour le monde!

Full Access
Question # 11

Given:

List longlist = List.of(“Hello”,”World”,”Beat”);

List shortlist = new ArrayList<>();

Which code fragment correctly forms a short list of words containing the letter “e”?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 12

Given:

A) An exception is thrown at run time.

B)

C) The compilation fails due to an error on line 2.

D) The compilation fails due to an error on line 1.

E)

F)

The compilation fails due to an error on line 3.

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

F.

Option F

Full Access
Question # 13

Given:

What is the result?

A.

The compilation fails.

B.

1.99,2.99,0

C.

1.99,2.99,0.0

D.

1.99,2.99

Full Access
Question # 14

Given:

What is the result?

A.

2134

B.

234

C.

2341

D.

214

Full Access
Question # 15

Which describes an aspect of Java that contributes to high performance?

A.

Java prioritizes garbage collection.

B.

Java has a library of built-in functions that can be used to enable pipeline burst execution.

C.

Java monitors and optimizes code that is frequently executed.

D.

Java automatically parallelizes code execution.

Full Access
Question # 16

Given these two classes:

And given this fragment:

Which describes the fragment?

A.

It throws IllegalMonitorStateException.

B.

It is subject to deadlock.

C.

It is subject to livelock.

D.

The code does not compile.

Full Access
Question # 17

Given:

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

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

Full Access
Question # 18

Given:

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

A)

B)

C)

A.

Option A

B.

Option B

C.

Option C

Full Access
Question # 19

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?

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.

Full Access
Question # 20

Given:

What is the result?

A.

2,34,34,5

B.

2,34,54,5

C.

2,54,54,5

D.

2,34,54,3

Full Access
Question # 21

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?

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.

Full Access
Question # 22

Given:

Which three classes successfully override printOne()? (Choose three.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

F.

Option F

Full Access
Question # 23

Given:

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

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;

Full Access
Question # 24

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?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 25

What makes Java dynamic?

A.

At runtime, classes are loaded as needed, and new code modules can be loaded on demand.

B.

The runtime can process machine language sources as well as executables from different language compilers.

C.

The Java compiler uses reflection to test if class methods are supported by resources of a target platform.

D.

The Java compiler preprocesses classes to run on specific target platforms.

Full Access
Question # 26

Which two statements correctly describe capabilities of interfaces and abstract classes? (Choose two.)

A.

Interfaces cannot have protected methods but abstract classes can.

B.

Both interfaces and abstract classes can have final methods.

C.

Interfaces cannot have instance fields but abstract classes can.

D.

Interfaces cannot have static methods but abstract classes can.

E.

Interfaces cannot have methods with bodies but abstract classes can.

Full Access
Question # 27

Given:

What is the result?

A.

The compilation fails.

B.

Y@<< hashcode>>

C.

Null

D.

HH

Full Access
Question # 28

Given:

Automobile.java

Car.java

What must you do so that the code prints 4?

A.

Remove the parameter from wheels method in line 3.

B.

Add @Override annotation in line 2.

C.

Replace the code in line 2 with Car ob = new Car();

D.

Remove abstract keyword in line 1.

Full Access
Question # 29

Given:

Which two statements can be added at line 1 in Bar to successfully compile it? (Choose two.)

A.

public List foo(Set m) { ... }

B.

public ArrayList foo(Set m) { ... }

C.

public List foo(TreeSet m) { ... }

D.

public List foo(Set m) { ... }

E.

public List foo(Set m) { ... }

F.

public ArrayList foo(Set m) { ... }

Full Access
Question # 30

Given the code fragment:

What is the result?

A.

0 8 10

B.

0

C.

The code prints nothing.

D.

0 4 9

E.

0 8

Full Access
Question # 31

Given:

You want the code to produce this output:

John

Joe

Jane

Which code fragment should be inserted on line 1 and line 2 to produce the output?

A.

Insert Comparator on line 1.

Insert

public int compare(Person p1, Person p2) {

return p1.name.compare(p2.name);

}

on line 2.

B.

Insert Comparator on line 1.

Insert

public int compareTo(Person person) {

return person.name.compareTo(this.name);

}

on line 2.

C.

Insert Comparable on line 1.

Insert

public int compare(Person p1, Person p2) {

return p1.name.compare(p2.name);

}

on line 2.

D.

Insert Comparator on line 1.

Insert

public int compare(Person person) {

return person.name.compare(this.name);

}

on line 2.

Full Access
Question # 32

Given:

What is the output?

A.

A compilation error is thrown.

B.

Message from Copier: Attempt00

C.

Message from Abstract Copier: Attempt00

D.

A runtime error is thrown.

Full Access
Question # 33

Given:

What is the type of x?

A.

char

B.

List

C.

String

D.

List

Full Access
Question # 34

Which statement about a functional interface is true?

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.

Full Access
Question # 35

Given:

and

checkQuality(QUALITY.A);

and

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

A.

QUALITY.A.ValueOf()

B.

A

C.

A.toString()

D.

QUALITY.A

Full Access
Question # 36

Given:

You want to obtain the Stream object on reading the file. Which code inserted on line 1 will accomplish this?

A.

var lines = Files.lines(Paths.get(INPUT_FILE_NAME));

B.

Stream lines = Files.readAllLines(Paths.get(INPUT_FILE_NAME));

C.

var lines = Files.readAllLines(Paths.get(INPUT_FILE_NAME));

D.

Stream lines = Files.lines(INPUT_FILE_NAME);

Full Access
Question # 37

Given:

public class X {

}

and

public final class Y extends X {

}

What is the result of compiling these two classes?

A.

The compilation fails because there is no zero args constructor defined in class X.

B.

The compilation fails because either class X or class Y needs to implement the toString() method.

C.

The compilation fails because a final class cannot extend another class.

D.

The compilation succeeds.

Full Access
Question # 38

Given:

Which statement is true about the Fox class?

A.

Fox class does not have to override inhabit method, so long as it does not try to call it.

B.

Fox class does not have to override the inhabit method if Forest and Town provide compatible implementations.

C.

Fox class must implement either Forest or Town interfaces, but not both.

D.

The inhabit method implementation from the first interface that Fox implements will take precedence.

E.

Fox class must provide implementation for the inhabit method.

Full Access