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

Free and Premium Oracle 1z0-808 Dumps Questions Answers

Page: 1 / 17
Total 224 questions

Java SE 8 Programmer I Questions and Answers

Question 1

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
Question 2

Given:

What is the result?

Options:

A.

Compilation fails at line n1.

B.

InitializedStartedInitialized

C.

InitializedStarted

D.

Compilation fails at line n2.

Question 3

Given the code fragment:

What is the result?

Options:

A.

3

B.

0

C.

Compilation fails.

D.

-1

Question 4

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 5

Given the code fragment:

Test.java:

Which is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 6

Given:

What is the result?

Options:

A.

myStr: 7007, myNum: 7007

B.

Error

C.

myStr: 9009, myNum: 7007

D.

myStr: 7007, myNum: 9009

Question 7

Given:

What is the result?

Options:

A.

null:null:0.0

B.

null:null

C.

<>:0.0

D.

null:0.0

Question 8

Given the code fragment:

What is the result?

Options:

A.

A B C Work done

B.

A B C D Work done

C.

A Work done

D.

Compilation fails

Question 9

Given the code fragments:

Which code fragment, when inserted at line n1, enables the code to print Hank?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 10

Given the code fragment:

What is the result?

Options:

A.

1 2 3 0 01 2 3 0 0

B.

An Exception is thrown at run time.

C.

1 2 3 0 01 2 3

D.

1 2 31 2 3

Question 11

Which two class definitions fail to compile? (Choose two.)

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 12

Given:

What is the result?

Options:

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Question 13

Given the code fragment:

What is the result?

Options:

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.

Question 14

Given:

Acc.java:

Which statement is true?

Options:

A.

Both p and s are accessible via obj.

B.

Only s is accessible via obj.

C.

Both r and s are accessible via obj.

D.

p, r, and s are accessible via obj.

Question 15

Given:

What is the result?

Options:

A.

Good Luck!

B.

Good Day!

C.

Welcome!

D.

Hello!

Question 16

Given the following code:

What are the values of each element in intArr after this code has executed?

Options:

A.

15, 60, 45, 90, 75

B.

15, 90, 45, 90, 75

C.

15, 30, 75, 60, 90

D.

15, 30, 90, 60, 90

E.

15, 4, 45, 60, 90

Question 17

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 18

Given the code fragment:

What is the result?

Options:

A.

true true

B.

true false

C.

false false

D.

false true

Question 19

Given the code fragment:

What is the result?

Options:

A.

An exception is thrown at runtime.

B.

2014-07-31T01:01:00

C.

2014-07-31

D.

2014-09-30T00:00:00

Question 20

Given:

And given the code fragment:

What is the result?

Options:

A.

300:300200:300

B.

300:100200:300

C.

300:00:300

D.

100:300300:200

Question 21

Given:

What is the result?

Options:

A.

C B A

B.

C

C.

A B C

D.

Compilation fails at line n1 and line n2

Question 22

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

Question 23

Given:

Which code fragment should you use at line n1 to instantiate the dvd object successfully?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 24

Given:

Which code fragment can replace the if block?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 25

Given:

What is the result?

Options:

A.

100 200 : 0 0 :

B.

100 200 : 100 0 :

C.

100 200 : 100 200 :

D.

0 0 : 100 0 :

Question 26

Given:

What is the result?

Options:

A.

3 4 5 6

B.

3 4 3 6

C.

5 4 5 6

D.

3 6 5 6

Question 27

Given:

and the code fragment:

S2 sobj = new S2(); sobj.display(10, 100);

What is the result?

Options:

A.

Child 10

Child 100

Parent 100

B.

Parent 10

Child 10

Parent 1000

C.

Child 10

Parent 100

Parent 100

D.

A compile time error occurs.

Question 28

Given:

What is the result?

Options:

A.

Compilation fails.

B.

11

C.

8

D.

9

E.

10

Question 29

Given this segment of code:

Which two statements, if either were true, would make the code compile? (Choose two.)

Options:

A.

MotorCycle is an interface that implements the Cycle class.

B.

Cycle is an interface that is implemented by the MotorCycle class.

C.

Cycle is an abstract superclass of MotorCycle.

D.

Cycle and MotorCycle both extend the Transportation superclass.

E.

Cycle and MotorCycle both implement the Transportation interface.

F.

MotorCycle is a superclass of Cycle.

Question 30

Given the code fragment:

And given the requirements:

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

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

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

Which two statements are true? (Choose two.)

Options:

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

Question 31

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

Question 32

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?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 33

Given the code fragments:

And:

Which statement is true?

Options:

A.

After line 11, three objects are eligible for garbage collection.

B.

After line 11, two objects are eligible for garbage collection.

C.

After line 11, one object is eligible for garbage collection.

D.

After line 11, none of the objects are eligible for garbage collection.

Question 34

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

Question 35

Given:

What is the result?

Options:

A.

Hello Log 1:0

B.

Hello Log 2:1

C.

Welcome Log 2:1

D.

Welcome Log 1:0

Question 36

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";

Question 37

Given:

What is the result?

Options:

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

Question 38

Given the code fragment:

Which modification enables the code fragment to print TrueDone?

Options:

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.

Question 39

Given the code fragment:

What is the result?

Options:

A.

EN FR JP

B.

EN FR

C.

CH

D.

EN FR CH

Question 40

Given the code fragment:

What is the result?

Options:

A.

Compilation fails.

B.

0 Found

C.

1 Found

D.

3 Found

Question 41

Given the code fragment:

What is the result?

Options:

A.

[JavaForum, ExpertForum]

B.

[JavaGroup, ExpertGroup]

C.

[JavaForumGroup, ExpertForumGroup]

D.

[JavaGroup, TechGroup ExpertGroup]

Question 42

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

Question 43

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

Question 44

Given:

What is the result?

Options:

A.

a, ei, i

B.

a, eo, o

C.

e, ei, i

D.

a, ao, o

Question 45

Given:

And the code fragment:

What is the result?

Options:

A.

C1C2

B.

C1C1

C.

Compilation fails.

D.

C2C2

Question 46

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

Options:

Question 47

Given:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 48

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

Question 49

Given the code fragment:

What is the result?

Options:

A.

true true

B.

true false

C.

false false

D.

false true

Question 50

Given the code fragment:

What is the result?

Options:

A.

100

B.

101

C.

102

D.

103

E.

Compilation fails

Question 51

Which is true about the switch statement?

Options:

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.

Question 52

Given:

What is the result?

Options:

A.

Area is 6.0

B.

Area is 3.0

C.

Compilation fails at line n1

D.

Compilation fails at line n2.

Question 53

Given:

What is the result?

Options:

A.

int main 1

B.

Object main 1

C.

String main 1

D.

Compilation fails

E.

An exception is thrown at runtime

Question 54

Given this code for a Planet object:

What is the output?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 55

Given the code fragment:

What is the result?

Options:

A.

S 6

B.

S 5

C.

s-1

D.

w 7

Question 56

Given the code fragment:

What is the result?

Options:

A.

A B C

B.

A B C D E

C.

A B D E

D.

Compilation fails.

Question 57

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 ();

Question 58

Which three statements are true about the structure of a Java class? (Choose three.)

Options:

A.

A class cannot have the same name as its field.

B.

A public class must have a main method.

C.

A class can have final static methods.

D.

A class can have overloaded private constructors.

E.

Fields need to be initialized before use.

F.

Methods and fields are optional components of a class.

Question 59

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

Question 60

Given the code fragment:

What is the result?

Options:

A.

1:2:3:4:5:

B.

1:2:3:

C.

Compilation fails.

D.

An ArrayOutOfBoundsException is thrown at runtime.

Question 61

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.

Question 62

Given the code fragment:

What is the result?

Options:

A.

3142

B.

2413

C.

1324

D.

4231

Question 63

Given this code for the classes MyException and Test:

What is the result?

Options:

A.

A

B.

AB

C.

A compile time error occurs at line n1.

D.

B

E.

I

Question 64

Given the code fragment:

What is the result if the integer aVar is 9?

Options:

A.

Compilation fails.

B.

10 Hello Universe!

C.

10 Hello World!

D.

9 Hello World!

Question 65

Given the code fragment:

Which code fragment, when inserted at line 3, enables the code to print 10:20?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 66

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.

Question 67

Given the code fragment:

Which modification enables the code to print 54321?

Options:

A.

Replace line 6 with System.out.print (--x);

B.

At line 7, insert x --;

C.

Replace line 5 with while (is Available(--x)) {

D.

Replace line 12 with return (x > 0) ? false : true;

Page: 1 / 17
Total 224 questions