quiz3 - Name: _ Dave's 15-100 Section: M N O P February 4,...

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

View Full Document Right Arrow Icon
1 Name: ____________________ Section: M N O P Dave's 15-100 February 4, 2009 Quiz 3 Reference Robot void move () //before: front must be clear void turnLeft () void makeLight () //before: must be on dark void makeDark () //before: must be on light boolean frontIsClear () boolean onDark () 1. Consider the following code segment. while (Robot.frontIsClear()) { Robot.turnLeft(); } In each of the following initial states, the robot is initially facing east. For each of these states, circle the direction the robot will be facing after this code segment has executed. If the code never terminates, circle infinite loop . north south east west infinite loop north south east west infinite loop north south east west infinite loop
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 2. The world is initially in the following state. The following code segment is now executed. while ( ! Robot.onDark()) { while (Robot.frontIsClear()) { Robot.move(); } Robot.turnLeft(); } On the diagram above, clearly mark the robot's final location and direction , after the code segment terminates.
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 / 4

quiz3 - Name: _ Dave's 15-100 Section: M N O P February 4,...

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