AP Computer Science Exam Practice 11
AP Computer Science Exam Practice 11
int num1 = 0;
int num2 = /* initial value not shown */;
int num3 = /* initial value not shown */;
(A) I only
(B) II only
(C) III only
(D) I and II
(E) I and III
(A) recurMethod("abcba")
(B) recurMethod("abcde")
(C) recurMethod("bcdab")
(D) recurMethod("edcba")
(E) recurMethod("edcde")
(A) The statement in line 3 will cause a compiler error because the message method for obj1 cannot
be found.
(B) The statement in line 4 will cause a compiler error because the message method for obj2 cannot
be found.
(C) As a result of the method call in line 3, the message method in class B will be executed instead of
the message method in class A.
(D) As a result of the method call in line 4, the message method in class B will be executed instead of
the message method in class A.
(E) The behavior of the code segment will remain unchanged.