Hard Multiple Choice QuestionsΒΆ

These problems are about the same or harder than those that you will typically see on the AP CS A exam.

11-8-1: Given the following method declaration, this method will return true if and only if:

public boolean check(String s)
{
   return s.length() >= 2 && (s.charAt(0) == s.charAt(1) || check(s.substring(1)));
}





11-8-2: Given the following method declaration, what will redo(82, 3) return?

public int redo(int i, int j)
{
   if (i==0)
      return 0;
   else
      return redo(i/j, j)+1;
}