6ESampleExam3_Ch5_

6ESampleExam3_Ch5_ - Name:_ Chapter 5 on Methods GCIS501...

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

View Full Document Right Arrow Icon
Chapter 5 on Methods GCIS501 Advanced Programming Gannon University Instructor: YK Liu (50 minutes) Part I: Multiple Choice Questions: (1 pts each) 1. A variable that is declared inside a method is called ________ variable. a. a static b. an instance c. a local d. a global e. a class 2. Each Java class must contain a main method. a. true b. false 3. What is (int)Math.random()? a. 0 b. 1 c. both 0 and 1 are possible d. None of the above 4. Analyze the following code: class Test { public static void main(String[] args) { System.out.println(xMethod((double)5)); } public static int xMethod(int n) { System.out.println("int"); return n; } public static long xMethod(long n) { System.out.println("long"); return n; } } a. The program displays int followed by 5. b. The program displays long followed by 5. c. The program runs fine but displays things other than given in a and b. d. The program does not compile. e.
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.

This note was uploaded on 01/17/2012 for the course GCIS 501 taught by Professor Liu during the Fall '09 term at Gannon.

Page1 / 5

6ESampleExam3_Ch5_ - Name:_ Chapter 5 on Methods GCIS501...

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