Weekend Biggest Discount Flat 70% Offer - Ends in 0d 00h 00m 00s - Coupon code: 70diswrap

Oracle 1z0-808 Dumps

Page: 1 / 22
Total 224 questions

Java SE 8 Programmer I Questions and Answers

Question 1

Given the code fragment:

as

What is the result?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 2

Given:

as

What is the result?

Options:

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Question 3

Given the code fragment:

as

What is the result?

Options:

A.

Compilation fails.

B.

0 Found

C.

1 Found

D.

3 Found

Question 4

Given:

as

What is the result?

Options:

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Question 5

Given the code fragment from three files:

as

Which code fragment, when inserted at line 2, enables the code to compile?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 6

Given:

as

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

Question 7

Given the code fragment:

as

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 8

Given the code fragment:

as

What is the result?

Options:

A.

An exception is thrown at runtime.

B.

Compilation fails.

C.

13480.0

D.

13480.02

Question 9

Given:

as

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 10

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

Question 11

Given the code fragments:

as

And:

as

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 12

Given the code fragment:

as

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.

Question 13

Given:

as

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 14

Given:

as

Which code fragment can replace the if block?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 15

Given the code fragment:

as

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.

Question 16

Given these requirements:

  • Bus and Boat are Vehicle type classes.
  • The start() and stop() methods perform common operations across the Vehicle class type.
  • The ride() method performs a unique operations for each type of Vehicle.

Which set of actions meets the requirements with optimized code?

Options:

A.

1. Create an abstract class Vehicle by defining start() and stop() methods, and declaring the ride()

abstract method.

2. Create Bus and Boat classes by inheriting the Vehicle class and overriding the ride() method.

B.

1. Create an interface Vehicle by defining start() and stop() methods, and declaring the ride()

abstract method.

2. Create Bus and Boat classes by implementing the Vehicle class.

C.

1. Create an abstract class Vehicle by declaring stop(), start(), and ride() abstract methods.

2. Create Bus and Boat classes by inheriting the Vehicle class and overriding all the methods.

D.

1. Create an interface Vehicle by defining default stop(), start(), and ride() methods.

2. Create Bus and Boat classes by implementing the Vehicle interface and overriding the ride()

method.

Question 17

Given the code fragment:

as

What is the result?

Options:

A.

3

B.

0

C.

Compilation fails.

D.

-1

Question 18

Given the code fragment:

as

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 19

Given the code fragment:

as

What is the result?

Options:

A.

EN FR JP

B.

EN FR

C.

CH

D.

EN FR CH

Question 20

Given:

as

What is the result?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 21

Given the code fragment:

as

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.

Question 22

Given the code fragment:

as

What is the result?

Options:

A.

[Robb, Rick, Bran]

B.

[Robb, Rick]

C.

[Robb, Bran, Rick, Bran]

D.

An exception is thrown at runtime.

Question 23

Given the code fragment:

as

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 24

Given:

as

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 25

Given the code snippet from a compiled Java source file:

as

and this output:

as

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

Question 26

Given this code for the classes MyException and Test:

as

What is the result?

Options:

A.

A

B.

AB

C.

A compile time error occurs at line n1.

D.

B

E.

I

Question 27

Given:

as

Given the code fragment:

as

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

Question 28

Given:

as

And given the code fragment:

as

What is the result?

Options:

A.

300:300200:300

B.

300:100200:300

C.

300:00:300

D.

100:300300:200

Question 29

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.

Question 30

Given the code fragment:

as

What is the result?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 31

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 32

Given:

as

What is the result?

Options:

A.

10:20

B.

0:20

C.

Compilation fails at line n1

D.

Compilation fails at line n2

Question 33

Given the code fragment:

as

What is the result?

Options:

A.

2012-02-10

B.

2012-01-30

C.

2012-02-10 00:00

D.

A DateTimeException is thrown at runtime.

Question 34

Given the following code:

as

What is the output?

Options:

A.

44

B.

35

C.

47

D.

54

E.

45

F.

421

Question 35

Given the code fragment:

as

What is the result?

Options:

A.

It results in a compile time error at line 18.

B.

It results in a compile time error at line 9.

C.

It prints : 1

D.

It results in a compile time error at lines at lines 12 and 15.

Question 36

Given the code fragment:

as

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

Question 37

Given these classes:

as

And given this main method:

as

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

Options:

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;

Question 38

Given this class:

as

And given this main method, located in another class:

as

Which three lines, when inserted independently at line n1, cause the program to print a 0 balance?

Options:

A.

acct.setAmount(-acct.getAmount());

B.

acct.amount = 0;

C.

acct.setAmount(0);

D.

acct.getAmount() = 0;

E.

this.amount = 0;

F.

acct.changeAmount(0);

G.

acct.changeAmount(-acct.amount);

Question 39

Given the code fragment:

as

Which code fragment at line 10 prints Welcome 100?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 40

Given the code fragment:

as

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.

Question 41

Which statement is true about Java byte code?

Options:

A.

It can run on any platform.

B.

It can run on any platform only if it was compiled for that platform.

C.

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

D.

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

E.

It can run on any platform only if that platform has both the Java Runtime Environment and a Java compiler.

Question 42

Given:

as

What is the result?

Options:

A.

Compilation fails.

B.

11

C.

8

D.

9

E.

10

Question 43

Given:

as

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 44

Given the code fragment:

as

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 45

Given the code fragment:

as

What is the result?

Options:

A.

A B C

B.

A B C D E

C.

A B D E

D.

Compilation fails.

Question 46

Given the code fragment:

as

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;

Question 47

Given:

as

What is the result?

Options:

A.

10

20

B.

A compile time error occurs

C.

20

20

D.

10

10

Question 48

Given the code fragment:

as

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 49

Given:

as

What is the result?

Options:

A.

200.0 : 100.0

B.

400.0 : 200.0

C.

400.0 : 100.0

D.

Compilation fails.

Question 50

Given the code fragment:

as

What is the result?

Options:

A.

2 4

B.

0 2 4 6

C.

0 2 4

D.

Compilation fails.

Question 51

Given the code fragment:

as

What is the result?

Options:

A.

2012-02-10 00:00

B.

2012-01-30

C.

2012-02-10

D.

A DateTimeException is thrown at runtime.

Question 52

Given the code fragments:

as

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 53

Given the code fragment:

as

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 54

Given the code fragment:

as

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

as

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 55

Given:

as

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 56

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 57

Given the code fragment:

as

What is the result?

Options:

A.

A B C

B.

A B C D E

C.

A B D E

D.

Compilation fails.

Question 58

Given the code fragment:

as

What is the result?

Options:

A.

AB

B.

A element 0B element 1

C.

A NullPointerException is thrown at runtime.

D.

A 0B 1

Question 59

You are asked to create a method that accepts an array of integers and returns the highest value from that array.

Given the code fragment:

as

Which method signature do you use at line n1?

Options:

A.

public int findMax (int[] numbers)

B.

static int[] findMax (int[] max)

C.

static int findMax (int[] numbers)

D.

final int findMax (int[] )

Question 60

Given the code fragment:

as

Which code fragment, inserted at line n1, prints The Top element: 30?

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 61

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

as

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Question 62

Given the code fragment:

as

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

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 63

Which two code fragments cause a compilation error? (Choose two.)

Options:

A.

float flt = 100.00F;

B.

float flt = (float) 1_11.00;

C.

Float flt = 100.00;

D.

double y1 = 203.22;float flt = y1;

E.

int y2 = 100;float flt = (float) y2 ;

Question 64

What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?

Options:

A.

Encapsulation

B.

Inheritance

C.

Abstraction

D.

Instantiation

E.

Polymorphism

Question 65

You are developing a banking module. You have developed a class named ccMask that has a maskcc method.

Given the code fragment:

as

You must ensure that the maskcc method returns a string that hides all digits of the credit card number except the four last digits (and the hyphens that separate each group of four digits).

Which two code fragments should you use at line n1, independently, to achieve this requirement? (Choose two.)

as

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Question 66

Given:

Acc.java:

as

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 67

Examine the content of App.java:

as

Which is true?

Options:

A.

The App.class file is stored within the p1 folder. The Test.class file is stored within the p2 sub-folder of p1.

B.

The App class is accessible within the Test class without an import statement.

C.

import p1.App; is used to access the App class within the Test class.

D.

It is optional to have the package statement as the first line of class definitions.

Page: 1 / 22
Total 224 questions