Study Guides (380,000)
CA (150,000)
UTSC (10,000)
All (20)

CSCA08 Final Exam Fall 2015Exam

Computer Science
Course Code
Study Guide

This preview shows pages 1-3. to view the full 16 pages of the document.
CSCA08 Fall 2015 Final Exam
Duration — 180 minutes
Aids allowed: none
Student Number:
Markus Login:
Last Name: First Name:
Do not turn this page until you have received the signal to start.
This exam consists of 5 questions on 16 pages (including this one). When you
receive the signal to start, please make sure that your copy is complete.
Proper documentation is required for all functions and code blocks. If you use
any space for rough work, indicate clearly what you want marked. Any pages
not attached to this cover page will not be marked. Please read all questions
thoroughly before starting on any work.
The University of Toronto’s Code of Behaviour on Academic Matters applies to
all University of Toronto Scarborough students. The Code prohibits all forms of
academic dishonesty including, but not limited to, cheating, plagiarism, and the use
of unauthorized aids. Students violating the Code may be subject to penalties up
to and including suspension or expulsion from the University.
# 1: / 5
# 2: / 5
# 3: /10
# 4: /10
# 5: /20
Total Pages = 16 Page 1 cont’d. . .

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

CSC A08 Fall 2015
[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of
your work that you want us to mark.]
Student #: Page 2 of 16 cont’d. . .

Only pages 1-3 are available for preview. Some parts have been intentionally blurred.

CSC A08 Fall 2015
Question 1. [5 marks]
Write the output of the following code in the space provided.
class GrandParent():
def __init__(self, a, b):
self._a = a
self._b = b
def blah(self):
return "GP:" + self._a + self._b
class Parent1(GrandParent):
def __init__(self, a, b, c):
GrandParent.__init__(self, a, b)
self._c = c
def blah(self):
return ("P1:" + self._a +
self._b + self._c)
class Parent2(GrandParent):
def __init__(self, a, b, c):
self._a = b
self._b = a
self._c = self.blah()
class Child1(Parent2):
def __init__(self, a, b, c, d):
Parent1.__init__(self, a, b, c)
self._d = d
class Child2(Parent1):
def __init__(self, a, b, c, d):
Child1.__init__(self, b, c, d, a)
Parent2.__init__(self, a, b, c)
def blah(self):
return ("C2: " + self._a + self._b
+ self._c + self._d)
gp = GrandParent("A", "B")
p1 = Parent1("A", "B", "C")
p2 = Parent2("A", "B", "C")
c1 = Child1("A", "B", "C", "D")
c2 = Child2("A", "B", "C", "D")
Student #: Page 3 of 16 cont’d. . .
You're Reading a Preview

Unlock to view full version