Go Back on 1z0-808 Exam
Available in 1, 3, 6 and 12 Months Free Updates Plans
PDF: $15 $60

Test Engine: $20 $80

PDF + Engine: $25 $99

1z0-808 Practice Test


Page 1 out of 48 Pages

Which two are Java Exception classes?


A.

SercurityException


B.

DuplicatePathException


C.

IllegalArgumentException


D.

TooManyArgumentsException





A.
  

SercurityException



C.
  

IllegalArgumentException



Given the code fragment

Which code fragments, inserted independently, enable the code compile?


A.

t.fvar = 200;


B.

cvar = 400;


C.

fvar = 200;
cvar = 400;


D.

this.fvar = 200;
this.cvar = 400;


E.

t.fvar = 200;
Test2.cvar = 400;


F.

this.fvar = 200;
Test2.cvar = 400;





B.
  

cvar = 400;



Given the code fragment:
public class Test {
public static void main(String[] args) {
boolean isChecked = false;
int arry[] = {1,3,5,7,8,9};
int index = arry.length;
while ( <code1> ) {
if (arry[index-1] % 2 ==0) {
isChecked = true;
}
<code2>
}
System.out.print(arry(index]+", "+isChecked));
}
}
Which set of changes enable the code to print 1, true?


A.

Replacing <code1> with index > 0 and replacing <code2> with index--;


B.

Replacing <code1> with index > 0 and replacing <code2> with --index;


C.

Replacing <code1> with index > 5 and replacing <code2> with --index ;


D.

Replacing <code1> with index and replacing <code2> with --index ;





A.
  

Replacing <code1> with index > 0 and replacing <code2> with index--;



Note: Code in B (code2 is -index;). also works fine.



What is the result?


A.

int main 1


B.

Object main 1


C.

String main 1


D.

Compilation fails


E.

An exception is thrown at runtime





C.
  

String main 1



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.





B.
  

NegativeArraySizeException



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


Page 1 out of 48 Pages