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

1z0-808 Java SE 8 Programmer I Questions and Answers

Questions 4

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

Buy Now
Questions 5

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 6

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 7

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 8

Given:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 9

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 10

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 11

Given the code fragment:

What is the result?

Options:

A.

3

B.

0

C.

Compilation fails.

D.

-1

Buy Now
Questions 12

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.

Buy Now
Questions 13

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.

Buy Now
Questions 14

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 15

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.

Buy Now
Questions 16

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.

Buy Now
Questions 17

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.

Buy Now
Questions 18

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.

Buy Now
Questions 19

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

Buy Now
Questions 20

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 21

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 22

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 23

Given the code fragment from three files:

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 24

Given the code fragment:

What is the result?

Options:

A.

Compilation fails.

B.

0 Found

C.

1 Found

D.

3 Found

Buy Now
Questions 25

Given:

What is the result?

Options:

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Buy Now
Questions 26

Given:

What is the result?

Options:

A.

BaseDerivedA

B.

BaseDerivedB

C.

DerivedBDerivedB

D.

DerivedBDerivedA

E.

A ClassCastException is thrown at runtime.

Buy Now
Questions 27

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 28

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

Buy Now
Questions 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.

Buy Now
Questions 30

Given the code fragment:

What is the result?

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 31

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 32

Given:

What is the result?

Options:

A.

10:20

B.

0:20

C.

Compilation fails at line n1

D.

Compilation fails at line n2

Buy Now
Questions 33

Given the code fragment:

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.

Buy Now
Questions 34

Given the following code:

What is the output?

Options:

A.

44

B.

35

C.

47

D.

54

E.

45

F.

421

Buy Now
Questions 35

Given the code fragment:

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.

Buy Now
Questions 36

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 37

Given these classes:

And given this main method:

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;

Buy Now
Questions 38

Given this class:

And given this main method, located in another class:

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

Buy Now
Questions 39

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 40

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.

Buy Now
Questions 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.

Buy Now
Questions 42

Given:

What is the result?

Options:

A.

Compilation fails.

B.

11

C.

8

D.

9

E.

10

Buy Now
Questions 43

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:

Buy Now
Questions 44

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 45

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.

Buy Now
Questions 46

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;

Buy Now
Questions 47

Given:

What is the result?

Options:

A.

10

20

B.

A compile time error occurs

C.

20

20

D.

10

10

Buy Now
Questions 48

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 49

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 50

Given the code fragment:

What is the result?

Options:

A.

2 4

B.

0 2 4 6

C.

0 2 4

D.

Compilation fails.

Buy Now
Questions 51

Given the code fragment:

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.

Buy Now
Questions 52

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 53

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

Buy Now
Questions 54

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 55

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

Buy Now
Questions 56

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 57

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.

Buy Now
Questions 58

Given the code fragment:

What is the result?

Options:

A.

AB

B.

A element 0B element 1

C.

A NullPointerException is thrown at runtime.

D.

A 0B 1

Buy Now
Questions 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:

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[] )

Buy Now
Questions 60

Given the code fragment:

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

E.

Option E

Buy Now
Questions 61

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

Buy Now
Questions 62

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

Buy Now
Questions 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 ;

Buy Now
Questions 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

Buy Now
Questions 65

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

Given the code fragment:

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

Options:

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Buy Now
Questions 66

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.

Buy Now
Questions 67

Examine the content of App.java:

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.

Buy Now
Exam Code: 1z0-808
Exam Name: Java SE 8 Programmer I
Last Update: Dec 3, 2024
Questions: 224

PDF + Testing Engine

$140

Testing Engine

$105

PDF (Q&A)

$90