Advanced Placement Computer Science Section 2 Quiz


On your answer sheet write down the letter of the answer that best answers the question.


  1. What is the decimal conversion of the following binary number: 101010 A) 12 B) 5 C) 84 D) 42 E) none of the above

  2. For your main method which of the following is required in the declaration? A) public static B) private C) only public D) only static E) protected

  3. The Turtle interface the text uses is based on what programming language? A) Perl B) Logo C) C++ D) BASIC E) none of the above

  4. If you execute a line of code saying myTurtle = new Turtle(); you are creating a ____ of the Turtle class. A) method B) protected C) instance D) integer E) none of the above

  5. Which of the following would signal the start of a comment in Java? A) REM B) \\ C) ' D) // E) none of the above

  6. Which of the following would signal the end of a multi-line comment in Java (one started with a /*) A) // B) \\ C) REM D) */ E) none of the above

  7. The term used to describe when you take an existing class, and with another class add functionality onto it is referred to as A) polymorphism B) instancing C) extending D) deallocating E) none of the above

  8. What must be found at the end of every method in Java? A) end. B) */ C) ; D) } E) none of the above

  9. Turtle is a _____ of Turtlet A) owner B) subclass C) implement D) method E) none of the above

  10. Which of the following is not the name of a method built into the Turtle class? A) paint B) switchTo C) move D) rectangle E) none of the above

    For the following questions write on your answer sheet T if the statement is true, f otherwise

  11. The following starts the definition of a class named Johnson that inherits all of the methods from a class John: class John extends Johnson {

  12. The name of a .java file need not be named the same as the class it contains

  13. Java instructions (or expressions) that define what a method does are contained within the method body of the method.

  14. A turtle's movements are all relative to its existing location the screen. (if you move 90, 40 it starts where the Turtle was at the end of the last turtle instruction)

  15. In order to erase something the Turtle (assuming it is called aturtle) drew you can execute the following statement and then redraw over the drawing you want to erase: aturtle.switchTo (Turtle.WHITE)

  16. An object cannot have multiple variables which reference it.

    The following statements are based on the following section of code:

Turtle pat;

pat = new Turtle();

pat.move (90, 50);

Turtle chris;

chris = pat;

chris.move (90, 50);

pat = new Turtle();

pat.move (90, 50);


  1. The last pat.move (90, 50); line does not effect the location of where the turtle referenced by chris is.

  2. In the line chris.move(90, 50); you are moving the object that both pat and chris refers to.

  3. If I replace the final line pat.move (90, 50); with pat.move (270, 50); I won't change the output of the Turtle.

  4. The line chris=pat; assigns a new Turtle that starts off where pat was to chris.

  5. Oh boy, Sleep! That's where I'm a Viking!