Unit 5 Quiz Answers - Quiz 5 Answers 1 Which of the...

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

View Full Document Right Arrow Icon
Quiz 5 Answers 1 Which of the following is not an operation specified in the Critter class? a. getActors b. getNeighbors c. processActors d. getMoveLocations e. selectMoveLocation 2 Consider the following alternate version of the act method for the Critter class. public void act() {if(getGrid() == null) return; processActors(getActors()); makeMove(selectMoveLocation(getMoveLocations())); } How will this alternate version differ, if at all, from the original version? a. The alternate version will not compile correctly. b. The alternate version will behave exactly like the original version. c. The alternate version will always have the critter move forward, if that location is empty. d. The alternate version will throw an IllegalArgumentException when the processActors method is called. e. The alternate version will throw an IllegalArgumentException when the makeMove method is called. 3 Suppose that a subclass of Critter is intended to move either forward or backwards, each with equal probability. I. getMoveLocations() II. selectMoveLocation() III. makeMove() Which of these methods should be overridden in this subclass to make it move as intended? a. I only b. II only c. I and II only d. I and III only e. I, II, and III 4
Background image of page 1

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

View Full DocumentRight Arrow Icon
Suppose a class Chameleon2 extends ChameleonCritter . Chameleon2 is intended to behave exactly like a ChameleonCritter , except that it changes its color to the color of an actor to its left or right, with equal probability if there is an actor both left and right and no change in color if there is no actor to the left or right. I. getActors()
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.

This note was uploaded on 04/30/2010 for the course BIOLOGY BIOLOGy taught by Professor Hued during the Spring '10 term at Eastern Oregon.

Page1 / 5

Unit 5 Quiz Answers - Quiz 5 Answers 1 Which of 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