Labour Day Special 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exams65

Java SE 8 Programmer I Question and Answers

Java SE 8 Programmer I

Last Update May 3, 2024
Total Questions : 224

We are offering FREE 1z0-808 Oracle exam questions. All you do is to just go and sign up. Give your details, prepare 1z0-808 free exam questions and then go for complete pool of Java SE 8 Programmer I test questions that will help you more.

1z0-808 pdf

1z0-808 PDF

$35  $99.99
1z0-808 Engine

1z0-808 Testing Engine

$42  $119.99
1z0-808 PDF + Engine

1z0-808 PDF + Testing Engine

$56  $159.99
Questions 1

Given:

And given the code fragment:

What is the result?

Options:

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.

Discussion 0
Questions 2

Given:

And given the commands:

What is the result?

Options:

A.  

1 null

B.  

true false

C.  

false false

D.  

true true

E.  

A ClassCastException is thrown at runtime.

Discussion 0
Questions 3

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.

Discussion 0
Questions 4

Given the code fragment:

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

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 5

Given:

Which statement is true?

Options:

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

Discussion 0
Questions 6

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.

Discussion 0
Questions 7

Given:

And the code fragment:

Which code fragment, when inserted at line 14, enables the code to print Mike Found?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 8

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;

Discussion 0
Questions 9

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

Discussion 0
Questions 10

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.

Discussion 0
Questions 11

Given:

What is the result?

Options:

A.  

10

20

B.  

A compile time error occurs

C.  

20

20

D.  

10

10

Discussion 0
Questions 12

Given the following main method:

What is the result?

Options:

A.  

5 4 3 2 1 0

B.  

5 4 3 2 1

C.  

4 2 1

D.  

5

E.  

Nothing is printed

Discussion 0
Questions 13

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

Options:

A.  

Boolean available = “TRUE”:

B.  

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

C.  

Double price = 200D;

D.  

Integer pages = 20;

Discussion 0
Questions 14

Given the code fragment:

What is the result?

Options:

A.  

1324

B.  

2313

C.  

3142

D.  

4231

Discussion 0
Questions 15

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

Options:

A.  

int array[] = new int[3] {1, 2, 3};

B.  

int array[] = new int[3]; array[0] = 1;

array[1] = 2;

array[2] = 3;

C.  

int array[3] = new int[] {1, 2, 3};

D.  

int array[] = new int[3]; array = {1, 2, 3};

E.  

int array[] = new int[] {1,2,3};

Discussion 0
Questions 16

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

Discussion 0
Questions 17

You are asked to develop a program for a shopping application, and you are given this information:

  • The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
  • The int calculatePrice (Toy t) method calculates the price of a toy.
  • The void printToy (Toy t) method prints the details of a toy.

Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 18

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

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

Discussion 0
Questions 19

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

Discussion 0
Questions 20

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.

Discussion 0
Questions 21

Given the code fragment:

Which three code fragments are valid at line n1?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

E.  

Option E

Discussion 0
Questions 22

Given:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 23

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

Discussion 0
Questions 24

Given:

What is the result?

Options:

A.  

3 4 5 6

B.  

3 4 3 6

C.  

5 4 5 6

D.  

3 6 4 6

Discussion 0
Questions 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 :

Discussion 0
Questions 26

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

Discussion 0
Questions 27

You are asked to develop a program for a shopping application, and you are given this information:

  • The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
  • The int calculatePrice (Toy t) method calculates the price of a toy.
  • The void printToy (Toy t) method prints the details of a toy.

Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 28

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

Discussion 0
Questions 29

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

Discussion 0
Questions 30

Given:

Given the code fragment:

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

Options:

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

Discussion 0
Questions 31

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

Discussion 0
Questions 32

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

Discussion 0
Questions 33

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:

Discussion 0
Questions 34

Given the code fragment:

What is the result?

Options:

A.  

S 6

B.  

S 5

C.  

s-1

D.  

w 7

Discussion 0
Questions 35

Given the code fragment:

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

Options:

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.

Discussion 0
Questions 36

Given the code fragment:

What is the result?

Options:

A.  

3

B.  

4

C.  

-1

D.  

Compilation fails.

Discussion 0
Questions 37

Given:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 38

Given:

What is the result?

Options:

A.  

10 : 30 : 6

B.  

10 : 22 : 22

C.  

10 : 22 : 20

D.  

10 : 22 : 6

Discussion 0
Questions 39

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

Discussion 0
Questions 40

Given:

What is the result?

Options:

A.  

Compilation fails.

B.  

11

C.  

8

D.  

9

E.  

10

Discussion 0
Questions 41

Given the code from the Greeting.Java file:

Which set of commands prints Hello Duke in the console?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 42

Given:

Which two code fragments can be inserted at line n1?

Options:

A.  

String str = “Java”;

B.  

for(int iVal = 0; iVal <=5; iVal++){}

C.  

Test() {}

D.  

package p1;

E.  

import java.io.*;

Discussion 0
Questions 43

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

Discussion 0
Questions 44

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.

Discussion 0
Questions 45

Given the code fragment:

Which option can replace xxx to enable the code to print 135?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 46

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

Discussion 0
Questions 47

Given:

Which code fragment can replace the if block?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 48

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

C.  

Its case label literals can be changed at runtime.

D.  

Its expression must evaluate to a collection of values.

Discussion 0
Questions 49

Given:

What is the result?

Options:

A.  

Compilation fails at line n1.

B.  

InitializedStartedInitialized

C.  

InitializedStarted

D.  

Compilation fails at line n2.

Discussion 0
Questions 50

Which two statements are true about Java byte code? (Choose two.)

Options:

A.  

It can be serialized across network.

B.  

It can run on any platform that has a Java compiler.

C.  

It can run on any platform.

D.  

It has “.java” extension.

E.  

It can run on any platform that has the Java Runtime Environment.

Discussion 0
Questions 51

Given the code fragment:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

E.  

Option E

Discussion 0
Questions 52

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

Discussion 0
Questions 53

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

Options:

A.  

A public class must have a main method.

B.  

A class can have only one private constructors.

C.  

A method can have the same name as a field.

D.  

A class can have overloaded static methods.

E.  

The methods are mandatory components of a class.

F.  

The fields need not be initialized before use.

Discussion 0
Questions 54

Given:

What is the result?

Options:

A.  

200.0 : 100.0

B.  

400.0 : 200.0

C.  

400.0 : 100.0

D.  

Compilation fails.

Discussion 0
Questions 55

Given:

And given the commands:

What is the result?

Options:

A.  

Java SE

B.  

Java EE

C.  

Compilation fails at line n1.

D.  

A NullPointerException is thrown at runtime.

Discussion 0
Questions 56

Given:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 57

Given the code fragment:

What is the result?

Options:

A.  

An exception is thrown at runtime.

B.  

07-31-2014

C.  

2014-07-31

D.  

2014-09-30

Discussion 0
Questions 58

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

Discussion 0
Questions 59

Given the code fragment:

What is the result?

Options:

A.  

May 04, 2014T00:00:00.000

B.  

2014-05-04T00:00: 00.000

C.  

5/4/14T00:00:00.000

D.  

An exception is thrown at runtime.

Discussion 0
Questions 60

Given:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 61

Given the code fragment:

What is the result?

Options:

A.  

100

B.  

101

C.  

102

D.  

103

E.  

Compilation fails

Discussion 0
Questions 62

Given:

What is the result?

Options:

A.  

Option A

B.  

Option B

C.  

Option C

D.  

Option D

Discussion 0
Questions 63

Given:

And given the commands:

What is the result?

Options:

A.  

Success

B.  

Failure

C.  

Compilation fails.

D.  

An exception is thrown at runtime

Discussion 0
Questions 64

Given the code fragment:

What is the result?

Options:

A.  

Compilation fails at both line n1 and line n2.

B.  

Compilation fails only at line n2.

C.  

Compilation fails only at line n1.

D.  

Jesse 25Walter 52

Discussion 0
Questions 65

Given:

And given the code fragment:

What is the result?

Options:

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

Discussion 0
Questions 66

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

E.  

Option E

Discussion 0
Questions 67

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

Discussion 0