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

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 11, 2009 Quiz 4 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. int x; int y; int z; boolean b; x = 10; y = x * 2; x = x + 1; z = y; y = y + 1; b = x > 100; What are the final values of x , y , z , and b ? x : __________ y : __________ z : __________ b : __________
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. For each of the following code segments, indicate the number of times that the doSomething method will be called . For this problem only, you should assume that all variables have already been declared to be of type int . If the loop would not terminate, write infinite loop . (Hint: At least one of these code segments will enter an infinite loop.) a. i = 3; while (i != 0) { doSomething(); i = i - 1; } __________ b. max = 30; i = 0; while (i < max) { doSomething();
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

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

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