Comp_113_midterm%20test2_sol_Fall09

Comp_113_midterm%20test2_sol_Fall09 - COMP113JavaProgramming

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

View Full Document Right Arrow Icon
COMP 113 – Java Programming Computing Science Department School of Advanced Technologies and Mathematics COURSE: COMP 113 INSTRUCTORS: Dr Nazeer Ahmed SEMESTER: Fall 2009 DATE: November 13, 2009 Student Name: _______________________________ Student Number: _______________ Part 1 – Objective Type Questions [05 marks] Q1. Static variables are also called -------------------------------------. (Multiple answers) a) Members of the class correct correct b) Class variables correct c) Local variables d) Class type variables e) Fields correct Q2. What values are returned by each of the following? a) Math.round(3.5); 4 b) Math.floor(2.99); 2.0 c) Math.pow(5.0, 4.0); 625 d) Math.abs (-4.9); 4.9 e) Math.sqrt(-9.0); Null (NaN) MIDTERM EXAMINATION II
Background image of page 1

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

View Full DocumentRight Arrow Icon
COMP113—Midterm_2_Fall 2009 Q3. A class specifies an object’s attributes and defines its behaviour as instance variable. (True / False ) Q4. The following for loop statement will produce a syntax error. (True / False ) for (val = 1, multiple = 1; val <= 100; multiple *= val, val++); Q5. Which of the following is true about methods those return values. (multiple Answer) a) The heading of the method contains the return type b) Method body contains return statement c) Method heading contain the key word void d) All of the above Q6. Arguments must match parameters in number, order and type. ( True / False) Q7. The private instance variables are accessible by name only within their class. ( True / False) Q8. A static method cannot call a nonstatic method unless it has an object to do so. ( True / False) Q9. A constructor can call another constructor by using keyword ----------------. This
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 / 5

Comp_113_midterm%20test2_sol_Fall09 - COMP113JavaProgramming

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