The University of Western Ontario
Department of Computer Science
Computer Science 1027b Midterm Exam Master
March 10, 2012
Print your name:______________________________________________
Student number: ______________________________________________
•Fill in your name and student number above immediately.
•Answer all the questions in the exam in the spaces provided.
•You have 2 hours to complete the exam.
•The exam has 8 questions on 15 pages, and is out of a possible 80 marks.
•The marks for each individual question are given. Allow approximately 1.5 minute
per mark on average.
•There is a page for rough work at the end of the exam paper.
•Read the questions carefully!
DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.
1 (max 15)
2 (max 5)
3 (max 10)
4 (max 15)
5 (max 10)
6 (max 10)
7 (max 10)
8 (max 5)
1. (15 marks) True/False (Circle your answers)
a) (1 mark) If two object references are equal in state, then they refer to the same object.
b) (1 mark) The time complexity of an algorithm consists of the most dominant term of its
c) (1 mark) Polymorphism allows a reference variable to point to objects of unrelated
d) (1 mark) Generic types are bound at compile time.
e) (1 mark) An interface can be used even when it is not implemented by another class.
f) (1 mark) Data encapsulation requires that instance variables be declared as private.
g) (1 mark) A time complexity of
for a program means that it will run in constant
h) (1 mark) Inherited variables and methods can be used in a derived class as if they had
been declared locally.
i) (1 mark) The child of a class can be the parent of one or more classes.
j) (1 mark) All Java classes are derived, directly or indirectly, from the Object class.
k) (1 mark) Polymorphism is made possible through class inheritance.
l) (1 mark) A static method within a class cannot be invoked without having to
instantiate an object of that class.
m) (1 mark) A Java interface should never have a constructor.
n) (1 mark) A Java interface never contains an attribute (instance variable) declaration.
o) (1 mark) A new class X derived from a class Y establishes an is-a relationship from
class X to class Y.