2007spring_mid - 1 30 2 20 3 30 4 20 Total 100 points CS101...

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

View Full Document Right Arrow Icon
1 2 3 4 Total 30 20 30 20 100 points CS101 Introduction to Programming Midterm Exam (2007 Spring) * Fill out the student information COMPLETELY. Section (class) (from A to L) Student ID Name * Students may ask the supervisor (TA) to translate the English words or sentences into Korean. * Students may write the answer either in English or Korean. 1. Answer each question by following the instruction. 1-1. Fill out the box with O if the answer is yes and with X for otherwise. // 5 points Q u e s t i o n O / X ex. JAVA is one of programming languages O (1) JAVA is one of low-level programming languages X (2) Interpreter (called Java Virtual Machine) translates a JAVA program into byte- code X (3) We call a library of classes as 'package' O (4) 'long' is one of integer data types O (5) The overloading means that two or more methods in a class are defined with same name, return type and parameters X 1-2. What will be the value of 'result' in each of the following statement. // 6 points ex. (1) (2) (3) int a=1; int result=a; double result = 2/3; boolean result = (0==1); int m = 4; int result=3*(m++); result : 1 result : 0.0 result : false result : 12
Background image of page 1

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

View Full DocumentRight Arrow Icon
1-3. When we execute the following source file (“ScannerTest.java”), where will the first error occur? ( 1 ) // 3 points 1-4. The ‘if-else’ statements (A) is to be changed into ‘switch’ statements (B). Fill out each blank with a suitable keyword. (Refer to the keyword list) // 4 points (A) (B) // “ScannerTest.java” public class ScannerTest { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); // ① int a = keyboard.nextInt(); // ② double b = keyboard.nextInt(); // ③ String c = keyboard.nextLine(); // ④ String void = keyboard.next(); // ⑤ } } int coin = 100; if(coin == 10) System.out.println("can do nothing with this!"); else if(coin == 100) System.out.println("can use a public phone."); else if(coin == 500) System.out.println("can buy an ice cream."); else System.out.println("does it exist?"); int coin = 100; (1) switc h (coin) { (2) cas e 10: System.out.println("can do nothing with this!"); (3) Brea k ; [keyword list] break, case, default, do, else, final, for, if, return, static, switch, void, while [Answer] (1) switch (2) case (3) break (4) default
Background image of page 2
1-5. What will be the result to be obtained when the following program is executed? ( 2
Background image of page 3

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

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

Page1 / 10

2007spring_mid - 1 30 2 20 3 30 4 20 Total 100 points CS101...

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

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