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 11 out of 48 Pages

Which statement best describes encapsulation?
Which statement best describes encapsulation?


A.

. Encapsulation ensures that classes can be designed so that only certain fields and
methods of an object are accessible from other objects.


B.

Encapsulation ensures that classes can be designed so that their methods are
inheritable.


C.

 Encapsulation ensures that classes can be designed with some fields and methods
declared as abstract.
t method.


D.

Encapsulation ensures that classes can be designed so that if a method has an
argument MyType x, any subclass of MyType can be passed to tha





A.
  

. Encapsulation ensures that classes can be designed so that only certain fields and
methods of an object are accessible from other objects.



Given:
 
public class Test {
public static void main(String[] args) {
try {
String[] arr =new String[4];
arr[1] = "Unix";
arr[2] = "Linux";
arr[3] = "Solarios";
for (String var : arr) {
System.out.print(var + " ");
}
} catch(Exception e) {
System.out.print (e.getClass());
}
}
}
What is the result?


A.

A. Unix Linux Solaris


B.


BNull Unix Linux Solaris


C.

Class java.lang.Exception


D.

Class java.lang.NullPointerException





B.
  


BNull Unix Linux Solaris



null Unix Linux Solarios
The first element, arr[0], has not been defined

Given:

What would be the output, if it is executed as a program?


A.

name =, pass =


B.

name = null, pass = null


C.

name = null, pass = false


D.

 name = null pass = true


E.

Compile error.





C.
  

name = null, pass = false



Both name and pass variables are instance variables, and we haven't given them any
values, so they take their default values. For Boolean default value is false and for string
which is not a primitive type default is null So at line 7, null will printed as the value of the
variable name, and at line 8 false will be printed. Hence Option C is correct.
As explained above options A, B and D are incorrect.
Code compiles fine so option E is incorrect.
Reference:
https://docs.oracle.com/javaseAutorial/java/javaOOAariables.html

Given:

What is the result?


A.

 10:20


B.

0:20


C.

Compilation fails at line n1


D.

Compilation fails at line n2





D.
  

Compilation fails at line n2



Given the following array:


A.

Option A


B.

Option B


C.

Option C


D.

Option D


E.

Option E


F.

Option F





B.
  

Option B



E.
  

Option E



All the remaining options have syntax errors


Page 11 out of 48 Pages
Previous