Unit 3 Quiz Answers - Quiz 3 Answers 1 Assume the following...

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

View Full Document Right Arrow Icon
Quiz 3 Answers 1 Assume the following statements have been executed. Location loc1 = new Location(1,2); Location loc2 = new Location(2,3); Consider the expression dir == loc2.getDirectionToward(loc1) Which of the following replacements for " dir " will make this expression true? Choose one answer. a. Location.SOUTHEAST b. Location.NORTHWEST c. Location.WEST d. Direction.NORTHWEST e. No replacement will make the expression true because directions should be compared using ".equals(. ..)" rather than "==" Correct 2 Make the same assumptions as in the previous question. What will be returned by the call loc2.getAdjacentLocation(135)  ? Choose one answer. a. Location (1,2) b. Location (1,4) c. Location (3,2) d. Location (3,4) e. Nothing will be returned; the call will not compile because the parameter is the wrong type Correct 3 Assume that Grid<Actor> grd has been initialized as a bounded grid with 10 rows and 20 columns. What will be returned by the call grd.isValid(new Location(5, 20)) ? Choose one answer.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Unit 3 Quiz Answers - Quiz 3 Answers 1 Assume the following...

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

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