Want to Pass 1z0-808 Exam In Next HOURS? Get it now →
May 19, 2017

Why You Need To java se 8 programmer i 1z0 808?

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

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


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


Q133. Which statement will empty the contents of a StringBuilder variable named sb? 

A. sb.deleteAll(); 

B. sb.delete(0, sb.size()); 

C. sb.delete(0, sb.length()); 

D. sb.removeAll(); 

Answer:


Q134. Given: 

What is the result? 

A. 1 

B. 1 

C. 2 

D. Compilation fails 

E. The loop executes infinite times 

Answer:


Q135. Given: 

What is the result? 

A. x: 1 y: 2 

B. 3 y: 4 

C. x: 0 y: 0 

D. 3 y: 4 

E. x: 1 y: 2 

F. 0 y: 0 

G. x: 0 y: 0 

H. 0 y: 0 

Answer:


Q136. Given: 

What is the result? 

A. true:true 

B. true:false 

C. false:true 

D. false:false 

Answer:


Q137. Given the for loop construct: 

for ( expr1 ; expr2 ; expr3 ) { 

statement; 

Which two statements are true? 

A. This is not the only valid for loop construct; there exits another form of for loop constructor. 

B. The expression expr1 is optional. it initializes the loop and is evaluated once, as the loop begin. 

C. When expr2 evaluates to false, the loop terminates. It is evaluated only after each iteration through the loop. 

D. The expression expr3 must be present. It is evaluated after each iteration through the loop. 

Answer: B,C 

Explanation: 

The for statement have this forms: 

for (init-stmt; condition; next-stmt) { 

body 

There are three clauses in the for statement. 

The init-stmt statement is done before the loop is started, usually to initialize an iteration 

variable. 

The condition expression is tested before each time the loop is done. The loop isn't 

executed if the boolean expression is false (the same as the while loop). 

The next-stmt statement is done after the body is executed. It typically increments an 

iteration variable. 


Q138. Which of the following exception will be thrown due to the statement given here? 

int array[] = new int[-2]; 

A. NullPointerException 

B. NegativeArraySizeException 

C. ArrayIndexOutOfBoundsException 

D. IndexOutOfBoundsException 

E. This statement does not cause any exception. 

Answer:

Explanation: 

In given statement we can see that, we have passed negative value for creating int array, 

which results a NegativeArraySize Except ion. Hence option B is correct. 

Option A is incorrect as it is thrown when an application attempts to use null in a case 

where an object is required. 

Option D is incorrect as IndexOutOfBoundsException thrown to indicate that an index of 

some sort (such as to an array, to a string, or to a vector) is out of range. 

REFERENCE 

rhttpy/docs.oracle.com/iavase/S/docs/api/java/lang/NegativeArraySizeException.html 


Q139. Given: 

What is the result? 

A. Red 0 

Orange 0 

Green 3 

B. Red 0 

Orange 0 

Green 6 

C. Red 0 

Orange 1 

D. Green 4 

E. Compilation fails 

Answer:


Q140. Given: 

What is the result? 

A. Shining Sun Shining Sun Shining Sun 

B. Shining Sun Twinkling Star Shining Sun 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:



see more http://www.ubraindumps.com/1z0-808-dumps/