Oracle certification · Exam 1z0-808

1z0-808 Mock Exam Page 3

Java SE 8 Programmer I

Free 1z0-808 mock exam questions 21–30, each with the answer and an explanation.

20 questions · 33 minutes · free, no sign-up

Free 1z0-808 questions

21–30 of 70 free
Question 21 Choose 1

Given:

What is the result?

Show answerHide answer

Correct answer: C

myStr: 7007, myNum: 9009

Question 22 Choose 1

Given:
import java.util.*;
public class Ref {
public static void main(String[] args) {
StringBuilder s1 = new StringBuilder("Hello Java!");
String s2 = s1.toString();
List<String> lst = new ArrayList<String>();
lst.add(s2);
System.out.println(s1.getClass());
System.out.println(s2.getClass());
System.out.println(lst.getClass());
}
}
What is the result?

Show answerHide answer

Correct answer: C

class java.lang.StringBuilder
class java.lang.String
class java.util.ArrayList

Explanation

class java.lang.StringBuilder
class java.lang.String
class java.util.ArrayList

Question 23 Choose 1

Given the code fragment:

What is the result?

Show answerHide answer

Correct answer: C

false false

Question 24 Choose 1

Given:
public class TestField {
int x;
int y;
public void doStuff(int x, int y) {
this.x = x;
y =this.y;
}
public void display() {
System.out.print(x + " " + y + " : ");
}
public static void main(String[] args) {
TestField m1 = new TestField();
m1.x = 100;
m1.y = 200;
TestField m2 = new TestField();
m2.doStuff(m1.x, m1.y);
m1.display();
m2.display();
}
}
What is the result?

Show answerHide answer

Correct answer: C

 100 200 : 100 0 :

Question 25 Choose 1

Given the following two classes:

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?
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 method useElectricity method. An instance of the customer class should never
be able to tamper with or decrease the value of the member variable bill.


Show answerHide answer

Correct answer: B

Option B

Question 26 Choose 1

Show answerHide answer

Correct answer: B

a, e
o, o

Question 27 Choose 1

Given the code fragment:
What is the result?

Show answerHide answer

Correct answer: D

An exception is thrown at runtime.

Explanation

java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: HourOfDay

Question 28 Choose 1

Given:


What is the result?

Show answerHide answer

Correct answer: A

True false

Question 29 Choose 1

Given:

What is the result?

Show answerHide answer

Correct answer: E

Compilation fails

Question 30 Choose 2

Which two are benefits of polymorphism?

Show answerHide answer

Correct answer: C, D

More dynamic code at runtime

 More flexible and reusable code

Full mock exam

Sit the 1z0-808 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real 1z0-808 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full 1z0-808 mock exam
  • 65questions per mock
  • 105 mintime limit
  • 236questions in the bank
  • Newmock on every attempt