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

1z0-808 Exam Dumps - Java SE 8 Programmer I

Question # 4

Given the code fragments:

What is the result?

A.

Compilation fails only at line n1.

B.

Compilation fails only at line n2.

C.

Tool::exportTool::export

D.

Compilation fails at both line n1 and line2.

E.

RTool::exportTool::export

Full Access
Question # 5

Which one of the following code examples uses valid Java syntax?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 6

Given the code fragment:

What is the result?

A.

A B C Work done

B.

A B C D Work done

C.

A Work done

D.

Compilation fails

Full Access
Question # 7

Given:

And given the code fragment:

What is the result?

A.

Compilation fails at line n2.

B.

Compilation fails at line n1.

C.

20:20

D.

10:20

Full Access
Question # 8

Given:

What is the result?

A.

Compilation fails.

B.

false true

C.

true false

D.

true true

E.

false false

Full Access
Question # 9

Given:

What is the result?

A.

Compilation fails at line n1.

B.

InitializedStartedInitialized

C.

InitializedStarted

D.

Compilation fails at line n2.

Full Access
Question # 10

This grid shows the state of a 2D array:

The grid is created with this code:

Which line of code, when inserted in place of //line n1, adds an X into the grid so that the grid contains three consecutive Xs?

A.

grid[2][1] = ‘X’;

B.

grid[3][2] = ‘X’;

C.

grid[3][1] = ‘X’;

D.

grid[2][3] = ‘X’;

Full Access
Question # 11

Given the code fragment:

What is the result?

A.

2 : 7 : 3

B.

7 : 7 : 9

C.

2 : 7 : 0

D.

7 : 2 : 3

Full Access
Question # 12

Given these classes:

And given this main method:

Which two options compile when placed at line n1 of the main method? (Choose two.)

A.

director.stockOptions = 1_000;

B.

employee.salary = 50_000;

C.

manager.budget = 1_000_000;

D.

manager.stockOption = 500;

E.

employee.budget = 200_000;

F.

director.salary = 80_000;

Full Access
Question # 13

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 14

Given the code fragment:

Which code fragment, when inserted at line 9, enables the code to print true?

A.

String str2 = str1;

B.

String str2 = new String(str1);

C.

String str2 = sb1. toString();

D.

String str2 = "Duke";

Full Access
Question # 15

Which is true about the switch statement?

A.

Its expression can evaluate to a collection of values.

B.

The break statement, at the end of each case block, is optional.

C.

Its case label literals can be changed at runtime.

D.

It must contain the default section.

Full Access
Question # 16

Given these two classes:

Any amount of electricity used by a customer (represented by an instance of the Customer class) must contribute to the customer's bill (represented by the member variable bill) through the useElectricity method.

An instance of the Customer class should never be able to tamper with or decrease the value of the member variable bill.

How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 17

Given the code fragment:

What is the result?

A.

Sum is 600

B.

Compilation fails at line n1.

C.

Compilation fails at line n2.

D.

A ClassCastException is thrown at line n1.

E.

A ClassCastException is thrown at line n2.

Full Access
Question # 18

Given the code fragment:

What is the result?

A.

3

B.

0

C.

Compilation fails.

D.

-1

Full Access
Question # 19

Given:

What is the result? A. 0:0

100:0

B.null:0

100:0

C.0:0

100:200

D.null:null 100:null

Full Access
Question # 20

Given the code fragment:

What is the result?

A.

Element 0Element 1

B.

Null element 0Null element 1

C.

NullNull

D.

A NullPointerException is thrown at runtime.

Full Access
Question # 21

Given the definitions of the Bird class and the Peacock class:

and the code fragment:

Which code snippet can be inserted to print Fly.Dance. ?

A.

Bird p = new Peacock();

B.

Bird b = new Bird();Peacock p = (Peacock) b;

C.

Peacock b = new Peacock ();Bird p = (Bird) b;

D.

Bird b = new Peacock ();Peacock p = (Peacock) b;

Full Access
Question # 22

Given the code fragment:

What is the result?

A.

1:2:3:4:5:

B.

1:2:3:

C.

Compilation fails.

D.

An ArrayOutOfBoundsException is thrown at runtime.

Full Access
Question # 23

Given:

What is the result?

A.

10 : 30 : 6

B.

10 : 22 : 22

C.

10 : 22 : 20

D.

10 : 22 : 6

Full Access
Question # 24

Given:

And given the code fragment:

What is the result?

A.

4W 100 Auto4W 150 Manual

B.

null 0 Auto4W 150 Manual

C.

Compilation fails only at line n1

D.

Compilation fails only at line n2

E.

Compilation fails at both line n1 and line n2

Full Access
Question # 25

Given:

And given the code fragment:

What is the result?

A.

Compilation fails at line n2.

B.

Read Book

C.

Read E-Book

D.

Compilation fails at line n1.

E.

Compilation fails at line n3.

Full Access
Question # 26

Given the code fragment:

What is the result?

A.

A B C

B.

A B C D E

C.

A B D E

D.

Compilation fails.

Full Access
Question # 27

Given the code fragment:

What is the result?

A.

2012-02-10

B.

2012-02-11

C.

Compilation fails

D.

A DateTimeException is thrown at runtime.

Full Access
Question # 28

Given:

Which statement is true?

A.

The program executes and prints:

500.0

B.

Commenting line 16 enables the program to print:

Thank You! 500.0

C.

Commenting line 13 enables the program to print:

Thank You! 500.0

D.

The program executes and prints:

Thank You! 500.0

Full Access
Question # 29

Given the definitions of the MyString class and the Test class:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 30

Given the code fragment:

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 31

Given:

What is the result?

A.

200.0 : 100.0

B.

400.0 : 200.0

C.

400.0 : 100.0

D.

Compilation fails.

Full Access
Question # 32

Which statement is true about the main() method?

A.

It is invoked by JRE

B.

It is a final method

C.

It returns true if it is executed successfully at run time

D.

It must be defined within a public class

Full Access
Question # 33

Given the code fragment:

What is the result?

A.

A NullPointerException is thrown at runtime.

B.

[1, 2, 4]

C.

[1, 2, 4, null]

D.

[1, 3, 4, null]

E.

[1, 3, 4]

F.

Compilation fails.

Full Access
Question # 34

Given the code fragment:

Which three lines fail to compile? (Choose three.)

A.

Line 7

B.

Line 8

C.

Line 9

D.

Line 10

E.

Line 11

F.

Line 12

Full Access
Question # 35

Given these classes:

And given this main method:

Which two options compile when placed at line n1 of the main method? (Choose two.)

A.

director.stockOptions = 1_000;

B.

employee.salary = 50_000;

C.

manager.budget = 1_000_000;

D.

manager.stockOption = 500;

E.

employee.budget = 200_000;

F.

director.salary = 80_000;

Full Access
Question # 36

Given:

And given the commands:

What is the result?

A.

1 null

B.

true false

C.

false false

D.

true true

E.

A ClassCastException is thrown at runtime.

Full Access
Question # 37

Which two initialization statements are valid? (Choose two.)

A.

Boolean available = “TRUE”:

B.

String tmpAuthor = author, author =”Mc Donald”;

C.

Double price = 200D;

D.

Integer pages = 20;

Full Access
Question # 38

Given:

What is the result?

A.

Welcome Visit Count:0Welcome Visit Count: 1

B.

Compilation fails at line n2.

C.

Compilation fails at line n1.

D.

Welcome Visit Count:0Welcome Visit Count: 0

Full Access
Question # 39

Given:

And given the code fragment:

What is the result?

A.

300:300200:300

B.

300:100200:300

C.

300:00:300

D.

100:300300:200

Full Access
Question # 40

Given the following main method:

What is the result?

A.

5 4 3 2 1 0

B.

5 4 3 2 1

C.

4 2 1

D.

5

E.

Nothing is printed

Full Access
Question # 41

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 42

Given the code fragment:

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 43

Given:

What is the result?

A.

null:null:0.0

B.

null:null

C.

<>:0.0

D.

null:0.0

Full Access
Question # 44

Given the code fragment:

Which modification enables the code fragment to print TrueDone?

A.

Replace line 5 With String opt = "true";Replace line 7 with case "true":

B.

Replace line 5 with boolean opt = l;Replace line 7 with case 1:

C.

At line 9, remove the break statement.

D.

Remove the default section.

Full Access
Question # 45

Given the code fragment:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 46

Given:

And the code fragment:

What is the result?

A.

C1C2

B.

C1C1

C.

Compilation fails.

D.

C2C2

Full Access
Question # 47

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 48

Which statement is true about the switch statement?

A.

It must contain the default section.

B.

The break statement, at the end of each case block, is mandatory.

C.

Its case label literals can be changed at runtime.

D.

Its expression must evaluate to a single value.

Full Access
Question # 49

Given:

What is the result?

A.

100 200 : 0 0 :

B.

100 200 : 100 0 :

C.

100 200 : 100 200 :

D.

0 0 : 100 0 :

Full Access
Question # 50

Given the code fragment:

Which code fragment, when inserted at line n1, enables the App class to print Equal?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 51

Given the code from the App.java file:

Which command prints SE 8 standard in the console window?

A.

java App ''SE 8'' Standard''

B.

java App ''SE 8 Standard''

C.

java App ''SE 8'' Standard

D.

java App SE 8 Standard

Full Access
Question # 52

Given:

Given the code fragment:

Which two sets of actions, independently, enable the code fragment to print Fit?

A.

At line n1 insert: import clothing.Shirt;At line n2 insert: String color = Shirt.getColor();

B.

At line n1 insert: import clothing;At line n2 insert: String color = Shirt.getColor();

C.

At line n1 insert: import static clothing.Shirt.getColor;At line n2 insert: String color = getColor();

D.

At line n1 no changes required.At line n2 insert: String color = Shirt.getColor();

E.

At line n1 insert: import Shirt;At line n2 insert: String color = Shirt.getColor();

Full Access
Question # 53

Given:

What is the result?

A.

9 5

B.

81 25

C.

Compilation fails.

D.

0 0

Full Access
Question # 54

Which statement is true about the switch statement?

A.

It must contain the default section.

B.

The break statement, at the end of each case block, is optional.

C.

Its case label literals can be changed at runtime.

D.

Its expression must evaluate to a collection of values.

Full Access
Question # 55

Given the code fragment:

What is the result?

A.

[Robb, Rick, Bran]

B.

[Robb, Rick]

C.

[Robb, Bran, Rick, Bran]

D.

An exception is thrown at runtime.

Full Access
Question # 56

Given:

What is the result?

A.

An exception is thrown at runtime.

B.

InitializedStartedInitialized

C.

InitializedStarted

D.

Compilation fails.

Full Access
Question # 57

Given the code fragment:

Which two code fragments can be independently inserted at line n1 to enable the code to print the elements of the array in reverse order? (Choose two.)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 58

Given the code fragment:

Which two modifications, made independently, enable the code to compile? (Choose two.)

A.

Make the method at line n1 public.

B.

Make the method at line n2 public.

C.

Make the method at line n3 public.

D.

Make the method at line n3 protected.

E.

Make the method at line n4 public.

Full Access
Question # 59

Given:

What is the result?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 60

Given the code fragment:

What is the result?

A.

A B C Work done

B.

A B C D Work done

C.

A Work done

D.

Compilation fails

Full Access
Question # 61

Given the code fragment:

And given the requirements:

1. Process all the elements of the array in the order of entry.

2. Process all the elements of the array in the reverse order of entry.

3. Process alternating elements of the array in the order of entry.

Which two statements are true? (Choose two.)

A.

Requirements 1, 2, and 3 can be implemented by using the enhanced for loop.

B.

Requirements 1, 2, and 3 can be implemented by using the standard for loop.

C.

Requirements 2 and 3 CANNOT be implemented by using the standard for loop.

D.

Requirement 1 can be implemented by using the enhanced for loop.

E.

Requirement 3 CANNOT be implemented by using either the enhanced for loop or the standard for loop.

Full Access
Question # 62

Given:

And given the commands:

What is the result?

A.

Java SE

B.

Java EE

C.

Compilation fails at line n1.

D.

A NullPointerException is thrown at runtime.

Full Access
Question # 63

Given this code for the classes MyException and Test:

What is the result?

A.

A

B.

AB

C.

A compile time error occurs at line n1.

D.

B

E.

I

Full Access
Question # 64

Given the code fragment:

What is the result?

A.

1:2:3:4:5:

B.

1:2:3:

C.

Compilation fails.

D.

An ArrayOutOfBoundsException is thrown at runtime.

Full Access
Question # 65

Given the code fragment:

Which three code fragments are valid at line n1?

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Full Access
Question # 66

Given:

And given the commands:

What is the result?

A.

Success

B.

Failure

C.

Compilation fails.

D.

An exception is thrown at runtime

Full Access
Question # 67

Given the code fragment:

What is the result?

A.

S 6

B.

S 5

C.

s-1

D.

w 7

Full Access