Exam Code: 1z0-808 (Practice Exam Latest Test Questions VCE PDF)
Exam Name: Java SE 8 Programmer I
Certification Provider: Oracle
Free Today! Guaranteed Training- Pass 1z0-808 Exam.

2017 Jan 1z0-808 dumps

Q31. Given: 

The class is poorly encapsulated. You need to change the circle class to compute and return the area instead. 

Which two modifications are necessary to ensure that the class is being properly encapsulated? 

A. Remove the area field. 

B. Change the getArea( ) method as follows: 

public double getArea ( ) { return Match.PI * radius * radius; } 

C. Add the following method: 

public double getArea ( ) {area = Match.PI * radius * radius; } 

D. Change the cacess modifier of the SerRadius ( ) method to be protected. 

Answer: B,D 


Q32. Given: 

What is the result? 

A. hEllOjAvA! 

B. Hello java! 

C. Out of limits hEllOjAvA! 

D. Out of limits 

Answer:


Q33. Given the code fragment: 

int b = 3; 

if ( !(b > 3)) { 

System.out.println("square "); 

}{ 

System.out.println("circle "); 

System.out.println("..."); 

What is the result? 

A. square... 

B. circle... 

C. squarecircle... 

D. Compilation fails. 

Answer:


Q34. Given: 

What is the result? 

A. 3 4 5 6 

B. 3 4 3 6 

C. 5 4 5 6 

D. 3 6 4 6 

Answer:


Q35. boolean log3 = ( 5.0 != 6.0) && ( 4 != 5); 

boolean log4 = (4 != 4) || (4 == 4); 

System.out.println("log3:"+ log3 + \nlog4" + log4); 

What is the result? 

A. log3:false log4:true 

B. log3:true log4:true 

C. log3:true log4:false 

D. log3:false log4:false 

Answer:


Abreast of the times 1z0-808 vce:

Q36. Given the code fragment: 

Which option can replace xxx to enable the code to print 135? 

A. int e = 0; e < = 4; e++ 

B. int e = 0; e < 5; e + = 2 

C. int e = 1; e < = 5; e + = 1 

D. int e = 1; e < 5; e+ =2 

Answer:


Q37. What is the proper way to defined a method that take two int values and returns their sum as an int value? 

A. int sum(int first, int second) { first + second; } 

B. int sum(int first, second) { return first + second; } 

C. sum(int first, int second) { return first + second; } 

D. int sum(int first, int second) { return first + second; } 

E. void sum (int first, int second) { return first + second; } 

Answer:


Q38. Given the code fragment: 

Which modification enables the code fragment to print TrueDone? 

A. Replace line 5 With String result = "true"; Replace line 7 with case "true": 

B. Replace line 5 with boolean opt = l; Replace line 7 with case 1= 

C. At line 9, remove the break statement. 

D. Remove the default section. 

Answer:


Q39. Given: 

class Cake { 

int model; 

String flavor; 

Cake() { 

model = 0; 

flavor = "Unknown"; 

public class Test { 

public static void main(String[] args) { 

Cake c = new Cake(); 

bake1(c); 

System.out.println(c.model + " " + c.flavor); 

bake2(c); 

System.out.println(c.model + " " + c.flavor); 

public static Cake bake1(Cake c) { 

c.flavor = "Strawberry"; 

c.model = 1200; 

return c; 

public static void bake2(Cake c) { 

c.flavor = "Chocolate"; 

c.model = 1230; 

return; 

What is the result? 

A. 0 unknown 0 unknown 

B. 1200 Strawberry 1200 Strawberry 

C. 1200 Strawberry 1230 Chocolate 

D. Compilation fails 

Answer:

Explanation: 1200 Strawberry 1230 Chocolate 


Q40. Given: 

public class Painting { 

private String type; 

public String getType() { 

return type; 

public void setType(String type) { 

this.type = type; 

public static void main(String[] args) { 

Painting obj1 = new Painting(); 

Painting obj2 = new Painting(); 

obj1.setType(null); 

obj2.setType("Fresco"); 

System.out.print(obj1.getType() + " : " + obj2.getType()); 

What is the result? 

A. : Fresco 

B. null : Fresco 

C. Fresco : Fresco 

D. A NullPointerException is thrown at runtime 

Answer: