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

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 18, 2009 Quiz 5 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 () Math double random () //returns value from 0 to almost 1 1. For each of the following, circle whether it could be a valid method call ? callA(int 2) valid invalid callB(n + 2) valid invalid callC(foo(n)) valid invalid callD(2) valid invalid callE(int n) valid invalid callF(n == 2) valid invalid callG(int) valid invalid callH(n) valid invalid callI(n, 2) valid invalid callJ() valid invalid
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. Consider the mystery method declared below. public static int mystery(int a) { int b; b = a; a = a + 1; return a + b; } Now consider the following code segment. a = 10; b = 20; result = mystery(a); laterA = a; laterB = b; After this code segment has executed, what will be the values of result , laterA , and laterB
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 09/14/2010 for the course CS 15-100 taught by Professor Dave during the Spring '08 term at Carnegie Mellon.

Page1 / 4

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

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