Examine the Code
Logic
DeBugging
Off-Topic
100

A Painter object called myPainter is facing north. Consider the following code segment.

while (!myPainter.isFacingSouth()) {
  myPainter.turnLeft();
}

myPainter.turnLeft();
myPainter.turnLeft();

The effect of this code is that the myPainter object is now facing which direction?


North

100

Which of the following statements is true?

A.   Performing a task in a program requires a method.

B.   A method contains the statements that actually performs its task.

C.   The algorithm that the method represents can consist of a combination of sequencing, selection, and iteration.

D.   All of the above.


D.   All of the above.

100

The Painter class contains the following method:

void paint(String color);

Would this instance using the object liam cause an error?

liam.paint();

yes

100

Who invented the chokeslam?

Abraham Lincoln

200

A Painter object called myPainter is initially facing east. Consider the following code segment.

while (myPainter.canMove()) {
  myPainter.move();
}

After the loop has terminated, which of the following MUST be true?

A.   The Painter object is blocked from moving north.

B.   The Painter object is blocked from moving south.

C.   The Painter object is blocked from moving east.

D.   The Painter object is blocked from moving west.

E.   The Painter object will crash into an object or wall.

C.   The Painter object is blocked from moving east.

200

Which of the following statements is false?

A.   An object's attributes are specified in a class.

B.   A Student object would likely have a gpa attribute that represents the current GPA.

C.   Each Student object knows its GPA but not the GPA of other Student objects.

D.   Attributes are specified by the class's methods.

D.   Attributes are specified by the class's methods.

200

Which of the following correctly instantiates a new Painter object?

A.   Painter daVinci = new Painter();

B.   daVinci Painter = new Painter();

C.   Painter daVinci = Painter();

D.   Painter() daVinci = new Painter;

E.   Painter daVinci = Painter;

A.   Painter daVinci = new Painter();

200

Ancient philosopher and wrestler whos is best known by his wrestling name that translates to mean "Broad".

Plato

300

Consider the following code segment.

if (myPainter.isFacingNorth()) {
  myPainter.move();
  myPainter.move();
}

if (!myPainter.isFacingNorth()) {
  myPainter.move();
  myPainter.paint("green");
}

What word could replace the 2nd condition?

else

300


Fill in the blank. Inheritance represents a/an ___ relationship.

 A.   has-a

 B.   has-many

C.   is-a

D.   is-many

 E.   None of the above.

C.   is-a

300


Consider the following method header:

public boolean mystery()

How many arguments are needed when calling the mystery() method?

A.   0

B.   1

 C.   2

 D.   3

 E.   Infinite

A.   0

300

Pop star who babysat Jeff Jarrett's kids in Highschool.

Taylor Swift

400

Consider the following code segment.

public class PainterPlus extends Painter {
   
  public void turnRight() {
    turnLeft();
    turnLeft();
    turnLeft();
  }
 
}


What is the name of the superclass?

A.   PainterPlus

B.   Painter

C.   SuperPainter

D.   MyNeighborhood

E.   turnRight()




B.   Painter

400


while(!myPainter.isFacingWest()) {
  myPainter.turnLeft();
}

What is the most number of times that the turnLeft() method would be called?

 A.   0

 B.   2

C.   3

D.   4

 E.   Infinite

C.   3

400


Painter myPainter = new Painter();

myPainter.turnLeft();
myPainter.turnLeft();
myPainter.turnLeft();

myPainter.move();
myPainter.turnLeft();

myPainter.move();
myPainter.takePaint();
myPainter.turnLeft();
myPainter.move();
myPainter.paint("green");

Which of the following initial conditions must be true for the code to run without error?

 A.   The Painter object was facing east.

 B.   The Painter object had paint.

C.   The Painter object could move forward.

D.   The Painter object does not have any paint.

 E.   The Painter object started on paint.

C.   The Painter object could move forward.

400

This ruler once tricked his people into growing potatoes by allowing them to be stolen from his royal garden.

Fredrick The Great

500
public class Food {
  //implementation not shown
}

public class Dessert extends Food {
  //implementation not shown
}

public class Cookie extends Dessert {
  //implementation not shown
}

Which statement below is true regarding the class declarations?

I. Food is a subclass of Cookie

II. Dessert is a superclass of Cookie

III. Cookie is a subclass of Dessert

IV. Cookie is a superclass of Food

 A.   I only

 B.   III only

 C.   I and II

 D.   II and IV

E.   II and III

E.   II and III

500


Which of the following evaluates to false?

I. true

II. !true

III. false

IV. !false

 A.   II only

 B.   III only

 C.   I and IV

D.   II and III

E.   III and IV

D.   II and III

500

Can a Superclass call a method that is unique to a subclass?

No

500

The year our building was built.

1912

M
e
n
u