Act now and download your Oracle 1z0 808 java se 8 programmer i test today! Do not waste time for the worthless Oracle 1z0 808 java se 8 programmer i tutorials. Download Up to the minute Oracle Java SE 8 Programmer I exam with real questions and answers and begin to learn Oracle 1z0 808 dumps pdf with a classic professional.

Q131. Given the following array: 

Which two code fragments, independently, print each element in this array? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

F. Option F 

Answer: B,E 

Explanation: All the remaining options have syntax errors 


Q132. Given: 

What is the output? 

A. 2015-03-27 

B. 2015-04-27 

C. 2015-02-27 D. Compilation fails due to error at line 6. 

E. Compilation fails due to error at line 8. 

Answer:

Explanation: 

To create we have used following method with LocalDate class; 

public static LocalDate of(intyear, int month, int dayOfMonth) 

Here we need to remember that month is not zero based so if you pass 1 for month, then 

month will be January. 

Then we have used period object of 1 day and add to date object which makes current date 

to next day, so final output is 2015-03-27. Hence option A is correct. 

https://docs.oracle.com/javase/tutorial/datetime/iso/datetime.html 


Q133. Given the code fragment: 

Which code fragment, when inserted at // insert code here, enables the code to compile and and print a b c? 

A. List update (String[] strs) 

B. Static ArrayListupdate(String [] strs) 

C. Static List update (String [] strs) 

D. Static void update (String[] strs) 

E. ArrayList static update(String [] strs) 

Answer:


Q134. Given: 

And given the code fragment: 

What is the result? 

A. 4W 100 Auto 4W 150 Manual 

B. Null 0 Auto 4W 150 Manual 

C. Compilation fails only at line n1 

D. Compilation fails only at line n2 

E. Compilation fails at both line n1 and line n2 

Answer:

Explanation: 

On line n1 implicit call to parameterized constructor is missing and n2 this() must be the first line. 


Q135. Given the code fragment: 

float x = 22.00f % 3.00f; 

int y = 22 % 3; 

System.out.print(x + ", "+ y); 

What is the result? 

A. 1.0, 1 

B. 1.0f, 1 

C. 7.33, 7 

D. Compilation fails 

E. An exception is thrown at runtime 

Answer:


Q136. public class ForTest { 

public static void main(String[] args) { 

int[] arrar = {1,2,3}; 

for ( foo ) { 

Which three are valid replacements for foo so that the program will compiled and run? 

A. int i: array 

B. int i = 0; i < 1; i++ 

C. ;; 

D. ; i < 1; i++ 

E. ; i < 1; 

Answer: A,B,C 


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


Q138. Given the code fragment: 

class Student { 

int rollnumber; 

String name; 

List cources = new ArrayList(); 

// insert code here 

public String toString() { 

return rollnumber + " : " + name + " : " + cources; 

And, 

public class Test { 

public static void main(String[] args) { 

List cs = newArrayList(); 

cs.add("Java"); 

cs.add("C"); 

Student s = new Student(123,"Fred", cs); 

System.out.println(s); 

Which code fragment, when inserted at line // insert code here, enables class Test to print 123 : Fred : [Java, C]? 

A. 

private Student(int i, String name, List cs) { 

/* initialization code goes here */ 

B. 

public void Student(int i, String name, List cs) { 

/* initialization code goes here */ 

C. 

Student(int i, String name, List cs) { 

/* initialization code goes here */ 

D. 

Student(int i, String name, ArrayList cs) { 

/* initialization code goes here */ 

Answer:

Explanation: 

Incorrect: 

Not A: Student has private access line: Student s = new Student(123,"Fred", cs); 

Not D: Cannot be applied to given types. Line: Student s = new Student(123,"Fred", cs); 


Q139. Given the code fragment: 

What is the result? 

A. Execution terminates in the first catch statement, and caught a RuntimeException is printed to the console. 

B. Execution terminates In the second catch statement, and caught an Exception is printed to the console. 

C. A runtime error is thrown in the thread "main". 

D. Execution completes normally, and Ready to us. is printed to the console. 

E. The code fails to compile because a throws keyword is required. 

Answer:


Q140. Given: 

public class MyClass { 

public static void main(String[] args) { 

while (int ii = 0; ii < 2) { 

ii++; 

System.out.println("ii = " + ii); 

What is the result? 

A. ii = 1 ii = 2 

B. Compilation fails 

C. The program prints nothing 

D. The program goes into an infinite loop with no output 

E. The program goes to an infinite loop outputting: ii = 1 ii = 1 

Answer:

Explanation: The while statement is incorrect. It has the syntax of a for statement. 

The while statement continually executes a block of statements while a particular condition is true. Its syntax can be expressed as: 

while (expression) { statement(s) } The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the while statement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false. 

Reference: The while and do-while Statements