• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 22 pages
Exam (elaborations)

UNIVERSITY OF TORONTO: Faculty of Arts & Science - CSC 108 H1F Exam Solution Guide.

Document preview thumbnail
Preview 3 out of 22 pages

UNIVERSITY OF TORONTO: Faculty of Arts & Science - CSC 108 H1F Exam Solution Guide.

Content preview

Page 1 of 22
UNIVERSITY OF TORONTO
Faculty of Arts & Science

December 2023 Examinations

CSC 108 H1F Do not turn this page
until you have received the signal to start.
Duration: 3 hours In the meantime,
please fill out the section below,
Aids Allowed: Provided aid sheet
and carefully read all instructions on this page.




First name (please write as legibly as possible within the boxes)




Last name




Student ID number (9 or 10 digits)




• This final examination consists of 14 questions on 22 pages (including this one), printed on both sides of the paper.
• Answer each question directly on the examination paper, in the space provided. There are several blank pages at
the end for rough work. Do not remove any pages from the exam booklet. If you need more space for one of
your solutions, use one of the blank pages and indicate clearly the part of your work that should be marked.
• We have provided an aid sheet with a list of useful Python function/method descriptions on a separate piece of
paper. Nothing you write on the aid sheet will be marked.
• Remember that, in order to pass the course, you must achieve a grade of at least 40% (28 marks) on this final
examination.
• As a student, you help create a fair and inclusive writing environment. If you possess an unauthorized aid during an
exam, you may be charged with an academic offence.

It’s been a real pleasure teaching you this term. Good luck!

Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 total
marks 3 4 8 3 5 3 5 2 6 3 6 10 4 8 70
students must hand in this examination booklet at the end

, Page 2 of 22 December 2023 Examinations
CSC 108 H1F
Duration: 3 hours



Question 1. [3 marks]
Complete the following function according to its docstring.

def upper_even(lst: list[str]) -> None:
"""Modify lst so that all strings at an even numbered index in lst are replaced
with an uppercase version of that string. Note: 0 is an even number

>>> lst = ['Abc', 'def', 'hello123', 'hi', 'moo!']
>>> upper_even(lst)
>>> lst
['ABC', 'def', 'HELLO123', 'hi', 'MOO!']
"""

# Hint: Use a string method to get the uppercase version of a string

, December 2023 Examinations Page 3 of 22
CSC 108 H1F
Duration: 3 hours



Question 2. [4 marks]
Write a complete header and docstring for the function below by completing the tasks marked TODO, so that the
docstring correctly describes the function body and the code runs correctly.

# TODO: Complete the parameter names and type contract



def mystery( ) -> :
"""
# TODO: Write a proper docstring description of the function here, e.g. "Return ..."




# TODO: Complete the following precondition with the appropriate parameter

Precondition: len( ) == 1

# TODO: Write two docstring examples with function calls that demonstrate
# different return values for the function

>>> mystery( )




>>> mystery( )




"""

result = ''

for ch in msg.lower():
if ch == ch_to_check.lower():
result = result + ch
return len(result) == count

Document information

Uploaded on
October 21, 2026
Number of pages
22
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
CA$21.16

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
elam17799
3.0
(4)
Sold
25
Followers
1
Items
222
Last sold
3 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions