CS1027midtermMaster2012.doc

47 views14 pages
The University of Western Ontario
Department of Computer Science
Computer Science 1027b Midterm Exam Master
March 10, 2012
2 hours
Print your name:______________________________________________
Student number: ______________________________________________
Instructions:
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)
TOTAL
(max 80)
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 14 pages and 3 million more documents.

Already have an account? Log in
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.
True False
b) (1 mark) The time complexity of an algorithm consists of the most dominant term of its
growth function.
True False
c) (1 mark) Polymorphism allows a reference variable to point to objects of unrelated
types.
True False
d) (1 mark) Generic types are bound at compile time.
True False
e) (1 mark) An interface can be used even when it is not implemented by another class.
True False
f) (1 mark) Data encapsulation requires that instance variables be declared as private.
True False
g) (1 mark) A time complexity of
)(nO
for a program means that it will run in constant
time.
True False
h) (1 mark) Inherited variables and methods can be used in a derived class as if they had
been declared locally.
True False
2
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 14 pages and 3 million more documents.

Already have an account? Log in
i) (1 mark) The child of a class can be the parent of one or more classes.
True False
j) (1 mark) All Java classes are derived, directly or indirectly, from the Object class.
True False
k) (1 mark) Polymorphism is made possible through class inheritance.
True False
l) (1 mark) A static method within a class cannot be invoked without having to
instantiate an object of that class.
True False
m) (1 mark) A Java interface should never have a constructor.
True False
n) (1 mark) A Java interface never contains an attribute (instance variable) declaration.
True False
o) (1 mark) A new class X derived from a class Y establishes an is-a relationship from
class X to class Y.
True False
3
Unlock document

This preview shows pages 1-3 of the document.
Unlock all 14 pages and 3 million more documents.

Already have an account? Log in

Get OneClass Grade+

Unlimited access to all notes and study guides.

Grade+All Inclusive
$10 USD/m
You will be charged $120 USD upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.