Winter Special Sale - Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 575363r9

Welcome To DumpsPedia

1z0-808 Sample Questions Answers

Questions 4

Given the code fragment:

Which two modifications, when made independently, enable the code to print Joe:true: 100.0? (Choose two.)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 5

Given:

What is the result?

Options:

A.

a, ei, i

B.

a, eo, o

C.

e, ei, i

D.

a, ao, o

Buy Now
Questions 6

Given:

What is the result?

Options:

A.

false, false

B.

false, true

C.

true, false

D.

true, true

Buy Now
Questions 7

Given:

and the code fragment:

What is the result?

Options:

A.

true:false:true

B.

false:true:true

C.

false:true:false

D.

true:true:false

Buy Now
Questions 8

Given:

What is the result?

Options:

A.

myStr: 9009, myNum: 9009

B.

myStr: 7007, myNum: 7007

C.

myStr: 7007, myNum: 9009

D.

Compilation fails

Buy Now
Questions 9

Given:

Which action fixes the compiler error?

Options:

A.

At line 17, add throws AccessViolationException

B.

At line 13, add throws LogFileException

C.

At line 2, replace throws LogFileException with throws AccessViolationException

D.

At line 7, insert throw new LogFileException ();

Buy Now
Questions 10

Given the code fragment:

What is the result?

Options:

A.

EN FR JP

B.

EN FR

C.

CH

D.

EN FR CH

Buy Now
Questions 11

Given the code fragment:

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

Options:

A.

Line 7

B.

Line 8

C.

Line 9

D.

Line 10

E.

Line 11

F.

Line 12

Buy Now
Questions 12

Given the code fragment:

Which two modifications enable the code to compile?

Options:

A.

Make the method at line 8 protected.

B.

Make the method at line 8 public.

C.

Make the method at line 10 protected.

D.

Make the method at line 4 public.

E.

Make the method at line 2 public.

Buy Now
Questions 13

Given the code fragment:

What is the result?

Options:

A.

The sum of 4 numbers is: 10

B.

A compile time error occurs.

C.

The sum of 5 numbers is: 10

D.

The sum of 5 numbers is: 15

Buy Now
Questions 14

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

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 15

Which statement is true about the switch statement?

Options:

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.

Buy Now
Questions 16

Given:

Which code fragment can replace the if block?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 17

Given the code fragment:

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

Options:

A.

String str2 = str1;

B.

String str2 = new String(str1);

C.

String str2 = sb1. toString();

D.

String str2 = "Duke";

Buy Now
Questions 18

Which statement is true about the main() method?

Options:

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

Buy Now
Questions 19

Given:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 20

Given the code fragments:

What is the result?

Options:

A.

Compilation fails only at line n2.

B.

RTool::exportTool::export

C.

Tool::exportTool:export

D.

Compilation fails only at line n1.

E.

Compilation fails at both line n1 and line n2.

Buy Now
Questions 21

Which three are advantages of the Java exception mechanism? (Choose three.)

Options:

A.

Improves the program structure because the error handling code is separated from the normal program function

B.

Provides a set of standard exceptions that covers all possible errors

C.

Improves the program structure because the programmer can choose where to handle exceptions

D.

Improves the program structure because exceptions must be handled in the method in which they occurred

E.

Allows the creation of new exceptions that are customized to the particular program being created

Buy Now
Questions 22

Given the code snippet from a compiled Java source file:

and this output:

Which command should you run to obtain this output?

Options:

A.

java MyFile 2

B.

java MyFile 1 2 3 4

C.

java MyFile 1 2 2

D.

java MyFile 2 2

Buy Now
Questions 23

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 24

Given:

And given the code fragment:

What is the result?

Options:

A.

Compilation fails at line n2.

B.

Compilation fails at line n1.

C.

20:20

D.

10:20

Buy Now
Questions 25

Given:

What is the result?

Options:

A.

true

B.

false

C.

-1

D.

0

Buy Now
Questions 26

Given the code fragment:

Assume that the system date is June 20, 2014. What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 27

Given the following classes:

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

Options:

A.

employee.salary = 50_000;

B.

director.salary = 80_000;

C.

employee.budget = 200_000;

D.

manager.budget = 1_000_000;

E.

manager.stockOption = 500;

F.

director.stockOptions = 1_000;

Buy Now
Questions 28

Given the code fragment:

What is the result?

Options:

A.

Compilation fails.

B.

Hi removed

C.

An UnsupportedOperationException is thrown at runtime.

D.

The program compiles, but it prints nothing.

Buy Now
Questions 29

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

Options:

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;

Buy Now
Questions 30

Given:

What is the result?

Options:

A.

200.0 : 100.0

B.

400.0 : 200.0

C.

400.0 : 100.0

D.

Compilation fails.

Buy Now
Questions 31

Given the code fragment:

You want the code to print:

Sold: 5 items. Stock in Hand: 5 Purchased: 5 items. Stock in Hand: 10?

Which action enables the code to print this?

Options:

A.

Declare the stock variable and the purchase(), sell(), and printStock() methods static.

B.

Declare the stock variable and the printStock() method static.

C.

Declare the stock and qty variables and the printStock() method static.

D.

Declare the stock variable static.

Buy Now
Questions 32

Given the code fragment:

Which two code fragments inserted at line 10 print ****?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 33

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 34

Given the code fragment:

What is the result?

Options:

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.

Buy Now
Questions 35

Given:

What is the result?

Options:

A.

Compilation fails.

B.

11

C.

8

D.

9

E.

10

Buy Now
Questions 36

Given:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 37

Given the code fragment:

What is the result?

Options:

A.

1 2 3 4followed by an ArrayIndexOutOfBoundsException

B.

1 2 3

C.

1 2 3 4

D.

Compilation fails.

Buy Now
Questions 38

Given the code fragment:

What is the result?

Options:

A.

Compilation fails.

B.

The program compiles, but it prints nothing.

C.

HiHowAreYou removed

D.

An UnsupportedOperationException is thrown at runtime.

Buy Now
Questions 39

Given:

What is the result?

Options:

A.

myStr: 7007, myNum: 7007

B.

Error

C.

myStr: 9009, myNum: 7007

D.

myStr: 7007, myNum: 9009

Buy Now
Questions 40

Given the code fragment:

What is the result?

Options:

A.

Answer = 0

B.

Invalid calculation

C.

Compilation fails only at line n1.

D.

Compilation fails only at line n2.

E.

Compilation fails at line n1 and line2.

Buy Now
Questions 41

Given the code fragment:

Which two modifications should you make so that the code compiles successfully? (Choose two.)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 42

Given:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 43

Given the code fragment:

Which code fragment at line 10 prints Welcome 100?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 44

Given:

What is the result?

Options:

A.

double sum is 30.0 float sum is 30.0

B.

float sum is 30.0 double sum is 30.0

C.

Integer sum is 30 double sum is 30.0

D.

Integer sum is 30 float sum is 30.0

Buy Now
Questions 45

Given:

What is the result?

Options:

A.

c=null

b=true

f=0.0

B.

c=

b=false

f=0.0

C.

c=null

b=false

f=0.0

D.

c=0

b=false

f=0.0F

Buy Now
Questions 46

Given the code fragment:

What is the result?

Options:

A.

[green, red, yellow, cyan]

B.

[green, blue, yellow, cyan]

C.

[green, red, cyan, yellow]

D.

An IndexOutOfBoundsException is thrown at runtime.

Buy Now
Questions 47

Given the code fragment:

What is the result?

Options:

A.

An exception is thrown at runtime.

B.

Compilation fails.

C.

13480.0

D.

13480.02

Buy Now
Questions 48

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?

Options:

A.

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

B.

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

C.

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

D.

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

Buy Now
Questions 49

Given this array:

Which two code fragments, independently, print each element in this array? (Choose two.)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

F.

Option F

Buy Now
Questions 50

Given the code fragment:

What is the result?

Options:

A.

Match 1

B.

Match 2

C.

No Match

D.

A NullPointerException is thrown at runtime.

Buy Now
Questions 51

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 52

Given the code fragment:

What is the result?

Options:

A.

[Robb, Rick, Bran]

B.

[Robb, Rick]

C.

[Robb, Bran, Rick, Bran]

D.

An exception is thrown at runtime.

Buy Now
Questions 53

Given the following code for the classes MyException and Test:

What is the result?

Options:

A.

A

B.

B

C.

Either A or B

D.

A B

E.

A compile time error occurs at line n1

Buy Now
Questions 54

Given:

What is the result?

Options:

A.

AB

B.

AC

C.

CC

D.

A ClassCastException is thrown only at line n1.

E.

A ClassCastException is thrown only at line n2.

Buy Now
Questions 55

Given the code fragment:

Which three code fragments can be independently inserted at line n1 to enable the code to print One? (Choose three.)

Options:

A.

byte x = 1;

B.

short x = 1;

C.

String x = "1";

D.

long x = 1;

E.

double x = 1;

F.

Integer x = new Integer("1");

Buy Now
Questions 56

Given:

What is the result?

Options:

A.

nullRichardDonald

B.

RichardDonald

C.

Compilation fails.

D.

An ArrayIndexOutOfBoundsException is thrown at runtime.

E.

A NullPointerException is thrown at runtime.

Buy Now
Questions 57

Examine the given definitions:

and the code fragment:

Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?

Options:

A.

Polymorphism, abstraction, and encapsulation are implemented.

B.

Only polymorphism and inheritance are implemented.

C.

Polymorphism, inheritance, and abstraction are implemented.

D.

Only inheritance and encapsulation are implemented.

Buy Now
Questions 58

Given the following code:

What is the output?

Options:

A.

44

B.

35

C.

47

D.

54

E.

45

F.

421

Buy Now
Questions 59

Which three statements describe the object-oriented features of the Java language? (Choose three.)

Options:

A.

Objects cannot be reused.

B.

A subclass must override the methods from a superclass.

C.

Objects can share behaviors with other objects.

D.

A package must contain a main class.

E.

Object is the root class of all other objects.

F.

A main method must be declared in every class.

Buy Now
Questions 60

Given:

What is the result?

Options:

A.

String main 1

B.

An exception is thrown at runtime

C.

String main 1 2 3

D.

String main 123

Buy Now
Questions 61

Given the code fragment:

and the requirements of the application:

  • It must display the menu.
  • It must print the option selected.
  • It must continue its execution till it reads ‘0’.

Which code fragment can be used to meet the requirements?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

OptionD

Buy Now
Questions 62

Given the code fragment:

Which code fragment prints red: blue: small: medium?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 63

Given the code fragment:

Which option represents the state of the num array after successful completion of the outer loop?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 64

Given the content of three files:

Which statement is true?

Options:

A.

Only the A.Java file compiles successfully.

B.

Only the B.java file compiles successfully.

C.

Only the C.java file compiles successfully.

D.

The A.Java and B.java files compile successfully.

E.

The B.java and C.java files compile successfully.

F.

The A.Java and C.java files compile successfully.

Buy Now
Questions 65

Which statement best describes encapsulation?

Options:

A.

Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.

B.

Encapsulation ensures that classes can be designed so that their methods are inheritable.

C.

Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.

D.

Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.

Buy Now
Questions 66

Given:

What is the result?

Options:

A.

10

20

B.

A compile time error occurs

C.

20

20

D.

10

10

Buy Now
Questions 67

Given the code fragment:

Which action enables it to print AB?

Options:

A.

Comment lines 18 to 21.

B.

Comment line 20.

C.

Comment line 19.

D.

Comment line 16.

Buy Now
Exam Code: 1z0-808
Exam Name: Java SE 8 Programmer I
Last Update: Nov 20, 2024
Questions: 224
$64  $159.99
$48  $119.99
$40  $99.99
buy now 1z0-808