♥♥ 2021 NEW RECOMMEND ♥♥
Free VCE & PDF File for Oracle 1z0-808 Real Exam (Full Version!)
★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions
Free Instant Download NEW 1z0-808 Exam Dumps (PDF & VCE):
Available on:
http://www.surepassexam.com/1z0-808-exam-dumps.html
Q21. Given the code fragment:
What is the result?
A. Element 0 Element 1
B. Null element 0 Null element 1
C. Null Null
D. A NullPointerException is thrown at runtime.
Answer: D
Q22. Given:
What is the output?
A. [21, 13, 11]
B. [30]
C. []
D. Compilation fails due to error at line 7
E. Compilation tails due to error at line 10
Answer: D
Explanation:
Option D is the correct answer.
Code fails to compile as we can't use primitive for collections type, so in this code trying to
use int at line 7, causes a compile error. We should have use wrapper. Integer there. So
option D is correct.
https://docs.oracle.eom/javase/8/docs/api/java/util/ArrayList.html
Q23. Given:
What is the result?
A. Compilation fails
B. The code compiles, but does not execute.
C. Paildrome
D. Wow
E. Mom
Answer: B
Q24. Given:
interface Pet { }
class Dog implements Pet { }
public class Beagle extends Dog{ }
Which three are valid?
A. Pet a = new Dog();
B. Pet b = new Pet();
C. Dog f = new Pet();
D. Dog d = new Beagle();
E. Pet e = new Beagle();
F. Beagle c = new Dog();
Answer: A,D,E
Explanation:
Incorrect:
Not B, not C: Pet is abstact, cannot be instantiated.
Not F: incompatible type. Required Beagle, found Dog.
Q25. Given:
abstract class A1 {
public abstract void m1();
public void m2() { System.out.println("Green"); }
}
abstract class A2 extends A1 {
public abstract void m3();
public void m1() { System.out.println("Cyan"); }
public void m2() { System.out.println("Blue"); }
}
public class A3 extends A2 {
public void m1() { System.out.println("Yellow"); }
public void m2() { System.out.println("Pink"); }
public void m3() { System.out.println("Red"); }
public static void main(String[] args) {
A2 tp = new A3();
tp.m1();
tp.m2();
tp.m3();
}
}
What is the result?
A. Yellow Pink Red
B. Cyan Blue Red
C. Cyan Green Red
D. Compilation Fails
Answer: A
Q26. Which of the following data types will allow the following code snippet to compile?
A. long
B. double
C. int
D. float
E. byte
Answer: B,D
Explanation:
Option B and D are the correct answer.
Since the variables I and j are floats, resultant will be float type too. So we have to use float
or primitive type which can hold float, such a primitive type is double, it has wider range
and also can hold floating point numbers, hence we can use double or float for the blank.
As explained above options B and D are correct.
long and int can't be used with floating point numbers so option A is incorrect.
Option E is incorrect as it have smaller range and also can't be used with floating point
numbers.
hnpsy/docs.oracle.com/javase/tutorial/java/javaOO/variables.html
Q27. Given the following code for a Planet object:
What is the output?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Answer: C
Q28. Given:
public class Test1 {
static void doubling (Integer ref, int pv) {
ref =20;
pv = 20;
}
public static void main(String[] args) {
Integer iObj = new Integer(10);
int iVar = 10;
doubling(iObj++, iVar++);
System.out.println(iObj+ ", "+iVar);
What is the result?
A. 11, 11
B. 10, 10
C. 21, 11
D. 20, 20
E. 11, 12
Answer: A
Explanation: The code doubling(iObj++, iVar++); increases both variables from to 10 to
11.
Q29. Given:
How many MarkList instances are created in memory at runtime?
A. 1
B. 2
C. 3
D. 4
Answer: A
Q30. Which of the following can fill in the blank in this code to make it compile?
A. abstract
B. final
C. private
D. default
E. int
Answer: C
Explanation:
From Java SE 8, we can use static and/or default methods in interfaces, but they should be non abstract methods. SO in this case using default in blank is completely legal. Hence option C is correct. Option A is incorrect as given method is not abstract, so can't use abstract there. Options B and E are incorrect as we can't have non abstract method interface if they are not default or static. httpsy/docs.oracle.com/javase/tutorial/iava/landl/defaultmethods.html
