Learn your Oracle Oracle practice materials from the basic as well as lay a solid foundation for your great good results in true work. You will enjoy a high popularity in the planet of IT. If you are a job hunter whos eager to have a Oracle Oracle 1z0-808 certification, please look zero further. There exists time to get rid of! Take measures at as soon as and you will end up being on the path to a vivid future shortly.

2021 Mar 1z0-808 exam engine

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

A. class java.lang.String class java.lang.String class java.util.ArrayList 

B. class java.lang.Object class java.lang. Object class java.util.Collection 

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

D. class java.lang.StringBuilder class java.lang.String class java.util.List 

Answer:

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


Q52. Given: 

public class TestOperator { 

public static void main(String[] args) { 

int result = 30 -12 / (2*5)+1; 

System.out.print("Result = " + result); 

What is the result? 

A. Result = 2 

B. Result = 3 

C. Result = 28 

D. Result = 29 

E. Result = 30 

Answer:


Q53. Given the code fragment: 

What is the result? 

A. 20 

B. 25 

C. 29 

D. Compilation fails 

E. AnArrayIndexOutOfBoundsException is thrown at runtime 

Answer:


Q54. Given the following code: 

What is the output? 

A. 4 

B. 3 

C. 4 

D. 5 

E. 4 

F. 4 

21 

Answer:


Q55. Given the code fragment: 

Which three code fragments can be independently inserted at line nl to enable the code to print one? 

A. Byte x = 1; 

B. short x = 1; 

C. String x = "1"; 

D. Long x = 1; 

E. Double x = 1; 

F. Integer x = new Integer ("1"); 

Answer: A,B,F 


Renovate 1z0-808 test questions:

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

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q57. Given the definitions of the MyString class and the Test class: 

What is the result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:


Q58. Given the code fragments: 

Which code fragment, when inserted at line ni, enables the code to print Hank? 

A. checkAge (iList, ( ) -> p. get Age ( ) > 40); 

B. checkAge(iList, Person p -> p.getAge( ) > 40); 

C. checkAge (iList, p -> p.getAge ( ) > 40); 

D. checkAge(iList, (Person p) -> { p.getAge() > 40; }); 

Answer:


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


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

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