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.
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 that method.
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;
Given:
public class TestLoop1 {
public static void main(String[] args) {
int a = 0, z=10;
while (a < z) {
a++;
--z;
}
System.out.print(a + " : " + z);
}
}
What is the result?
A. 5 : 5
B. 6 : 4
C. 6 : 5
D. 5 : 4
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)
Given the code fragments:

Which modification enables the code to compile?

A. B.

C. D.
Given:

What is the result?
A. Hello Log 2:2
B. Welcome Log 1:2
C. Welcome Log 2:1
D. Hello Log 1:2
Given:

What is the result?
A. C B A
B. C
C. A B C
D. Compilation fails at line n1 and line n2
Given: What is the result?

A. Base DerivedA
B. Base DerivedB
C. DerivedB DerivedB
D. DerivedB DerivedA
E. A ClassCastException is thrown at runtime.
Examine the given definitions:

and the code fragment:

Which statement is true about the implementation of Object-Oriented Programming concepts in the given code?
A. Polymorphism, abstraction, and encapsulation are implemented.
B. Only polymorphism and inheritance are implemented.
C. Polymorphism, inheritance, and abstraction are implemented.
D. Only inheritance and encapsulation are implemented.