Unit 2 Quiz Answers - Quiz 2 Answers 1 Consider the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Quiz 2 Answers 1 Consider the following circumstances for a bug. I. The bug has a flower immediately in front of it. II. The bug has a rock immediately in front of it. III. The bug has a wall (grid boundary) immediately in front of it. In which of these situations will the bug's canMove() method return false? Choose one answer. a. I only b. II only c. III only d. I and II only e. II and III only Correct 2 Which of the following best describes how a bug turns when its turn() method is called? Choose one answer. a. 45 degrees to the left b. 45 degrees to the right c. 90 degrees to the left d. 90 degrees to the right e. 45 degrees randomly to the left or right Correct 3 The reason there is no move method in BoxBug is. .. Choose one answer. a. A BoxBug never moves b. The move method is inherited from Actor c. The move method is inherited from BoxBug d. The move method is inherited from Bug e. The move method is hard-coded Correct 4 Consider replacing the following code from BoxBug: with this code:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How would this affect the boxbug's behavior? Choose one answer. a. The boxbug never turns, it continues in a straight line b. The boxbug turns once after drawing one side, then continues in a straight line c. There is no change in the boxbug pattern d. The boxbug never moves, it only turns e. The boxbug now makes a pattern like a Z Correct 5 Consider the following MysteryBug that extends Bug. The code for
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Unit 2 Quiz Answers - Quiz 2 Answers 1 Consider the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online