Want to know Ucertify 1z0 808 dumps Exam practice test features? Want to lear more about Oracle Java SE 8 Programmer I certification experience? Study Vivid Oracle java se 8 programmer i 1z0 808 answers to Updated 1z0 808 practice test questions at Ucertify. Gat a success with an absolute guarantee to pass Oracle java se 8 programmer i 1z0 808 (Java SE 8 Programmer I) test on your first attempt.

Q11. Given: 

class Mid { 

public int findMid(int n1, int n2) { 

return (n1 + n2) / 2; 

public class Calc extends Mid { 

public static void main(String[] args) { 

int n1 = 22, n2 = 2; 

// insert code here 

System.out.print(n3); 

Which two code fragments, when inserted at // insert code here, enable the code to compile and print 12? 

A. Calc c = new Calc(); int n3 = c.findMid(n1,n2); 

B. int n3 = super.findMid(n1,n3); 

C. Calc c = new Mid(); int n3 = c.findMid(n1, n2); 

D. Mid m1 = new Calc(); int n3 = m1.findMid(n1, n2); 

E. int n3 = Calc.findMid(n1, n2); 

Answer: A,D 

Explanation: 

Incorrect: 

Not B: circular definition of n3. 

Not C: Compilation error. line Calc c = new Mid(); 

required: Calc 

found: Mid 

Not E: Compilation error. line int n3 = Calc.findMid(n1, n2); 

non-static method findMid(int,int) cannot be referenced from a static context 


Q12. Given the code fragment: 

What is the result if the integer aVar is 9? 

A. 10 Hello world! 

B. 10 Hello universe! 

C. 9 Hello world! 

D. Compilation fails. 

Answer:


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

A. 100 200 : 100 200 

B. 100 0 : 100 0 : 

C. 100 200 : 100 0 : 

D. 100 0 : 100 200 : 

Answer:


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


Q15. Given: 

Which two code fragments are valid? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

Answer: B,C 

Explanation: When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class (C). However, if it does not, then the subclass must also be declared abstract (B). Note: An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed. 


Q16. Which of the following can fill in the blank in this code to make it compile? (Select 2 options.) 

A. On line 1, fill in throws 

B. On line 1, fill in throws new 

C. On line 2, fill in throw new 

D. On line 2, fill in throws 

E. On line 2, fill in throws new 

Answer: A,C 

Explanation: 

Option A and C are the correct answer. 

In a method declaration, the keyword throws is used. So here at line 1 we have to use 

option A. 

To actually throw an exception, the keyword throw is used and a new exception is created, 

so at line 2 we have to use throw and new keywords, which is option C. Finally it will look 

like; 

public void method() throws Exception { 

throw new Exception0; 

REFERENCE : httpsy/docs.oracle.com/javase/tutorial/essential/io/fileOps.html#exception 

The correct answer is: On line 1, fill in throws. On line 2, fill in throw new 


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

Explanation: The code doubling(iObj++, iVar++); increases both variables from to 10 to 

11. 


Q18. Which three statements describe the object-oriented features of the Java language? 

A. Objects cannot be reused. 

B. A subclass can inherit from a superclass. 

C. Objects can share behaviors with other objects. 

D. A package must contain more than one class. 

E. Object is the root class of all other objects. 

F. A main method must be declared in every class. 

Answer: B,C,E 


Q19. Given the code fragment: 

What is the result? 

A. 10 8 6 4 2 0 

B. 10 8 6 4 2 

C. AnArithmeticException is thrown at runtime 

D. The program goes into an infinite loop outputting: 10 8 6 4 2 0. . . 

E. Compilation fails 

Answer:


Q20. Given: 

What is the result? 

A. 0 Done 

B. First Exception Done 

C. Second Exception 

D. Done Third Exception 

E. Third Exception 

Answer: