COMP202-6

COMP202-6 - COMP 202 Summer 2006 School of Computer Science...

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

View Full Document Right Arrow Icon
COMP 202 Summer 2006 Final Exam Page 1 of 21 COMP 202 – Summer 2006 School of Computer Science - Faculty of Science - McGill University COMP 202 - Introduction to Computing 1 Final exam Version 1 July 3, 2006, 2:00 – 5:00 PM Instructor: Carlton Davis Last name ___________________________________ First name ___________________________________ Student ID ___________________________________ Instructions : No notebooks, textbooks or calculators are allowed in this exam. Language translation dictionaries are permitted. All answers should be written on the exam sheets. Part marks are given for all questions; so, show your work and attempt all questions For section 1 (multiple choice) mark your answer in this front page . Read the questions carefully . Grading Section I: Multiple choice Your mark:______ / 30 Question Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Your answer Mark / 3 / 3 / 3 / 3 / 3 / 3 / 3 / 3 / 3 / 3 Section II: Short Problems Your mark : ______ / 30 Question II.1 II.2 II.3 II.4 Mark /9 /5 /10 /6 Section III: Programming Problem Your mark: ______/ 40 Question III.1 III.2 Mark / 15 /25 Your Exam Score: _________/ 100
Background image of page 1

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

View Full DocumentRight Arrow Icon
COMP 202 Summer 2006 Final Exam Page 2 of 21 Section I: Multiple choice (3 points/question) I.1) What is the output of the following code fragment? public class Test { static boolean b; public static void main(String [] args) { short hand = 42; if (hand < 50 && !b) hand++; if (hand > 50); else if(hand > 40) { hand += 7; hand++; } else --hand; System.out.println(hand); } } A. 41 B. 43 C. 50 D. 51 E. It gives a compile error I.2) Which of the following is TRUE about protected variables in a given class? A. They are shared like static variables B. They cannot be changed once they have been assigned a value C. They can be accessed directly by subclasses D. They cannot be used as parameters E. None of the above I.3) Which of the following statement regarding the super keyword is INCORRECT? A. super can be used to invoke a superclass constructor B. super can be used to invoke a method in the base class C. super.super.p() can be used to invoked a method p() in the superclass's parent class D. super can be used to invoked a method in the superclass's parent class E. None of the above
Background image of page 2
COMP 202 Summer 2006 Final Exam Page 3 of 21 I.4) Which of the following statement(s) is/are TRUE? A. A method can be overloaded in the same class B. A method can be overrided in the same class C. If a method overloads another method both methods must have the same signature and return type D. All the above E. None of the above I.5) Consider the following code fragment public class Test { public static void main(String[] args) { Object a1 = new A(); Object a2 = new Object(); System.out.println(a1); System.out.println(a2); } } class A { int x; public String toString() { return "A's x is " + x; } } Which of the following is/are CORRECT? A.
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.

This test prep was uploaded on 04/09/2008 for the course COMP 202 taught by Professor Verbrugge during the Fall '07 term at McGill.

Page1 / 21

COMP202-6 - COMP 202 Summer 2006 School of Computer Science...

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