CSC326H1 20199 631598475152ece326 final ...
CSC326H1_20199_631598475152ece326_final_answer.pdf-Programming Languages Final Exam Solution ECE326,
Showing 1-3 out of 20
CSC326H1 20199 631598475152ece326 final answer.pdf...
CSC326H1_20199_631598475152ece326_final_answer.pdf-Programming Languages Final Exam Solution ECE326,
CSC326H1 20199 631598475152ece326 f...
CSC326H1_20199_631598475152ece326_final_answer.pdf-Programming Languages Final Exam Solution ECE326,
Page 1
Programming Languages
Final Exam Solution
ECE326, Fall 2019
University of Toronto
Duration:
2 hour 30 minutes
Examiner:
Kuei (Jack) Sun
Please fill your student number, last and first name below and then read the instructions carefully.
Student Number:
____ ____ ____ ____ ____ ____ ____ ____ ____ ____
Last Name:
First Name:
Instructions
Examination Aids: Examiner approved aid sheet is allowed.
Do not turn this page until you have received the signal to start.
Do not remove any sheets from this test book. Answer all questions
in the space provided. No additional sheets are permitted. Use the
blank space in last page as scratch space. Its content will not be
marked.
This exam consists of 8 questions on 20 pages (including this page).
The value of each part of each question is indicated. The total value
of all questions is 150 marks.
For the written answers, explain your reasoning clearly. Be as brief
and specific as possible. Clear, concise answers will be given higher
marks than vague, wordy answers. Marks will be deducted for
incorrect statements in an answer. Please write legibly!
Work independently.
MARKING GUIDE
Q1:
(11)
Q2:
(23)
Q3:
(17)
Q4:
(28)
Q5:
(10)
Q6:
(23)
Q7:
(26)
Q8:
(12)
Bonus:
(4)
Total
:
(150)
Page 1 of 20


Page 2
Programming Languages
Final Exam Solution
ECE326, Fall 2019
Question 1.
True or False
[11 marks]
Circle
T
if the statement is true, otherwise circle
F
if the statement is false. 1 mark each.
1.
In Python,
yield
is a statement.
T
F
2.
Python closures always capture outer variables by reference.
T
F
3.
C++ disallows overloading the dereference operator.
T
F
4.
SFINAE enables reflective programming in C++.
T
F
5.
Programming languages that perform late binding must have a method resolution
order.
This question is under-specified. Should also say “that supports inheritance”.
T
F
6.
Suppose
foo
is an immutable container that stores integers and overloads the
subscript operator, then
foo[0] = 5
is a semantically legal operation.
T
F
7.
The purpose of generic programming is code reuse across different data types.
T
F
8.
Rust allows implicit widening conversion.
T
F
9.
The Rust compiler will attempt to copy an object
only after
it decides that moving
the object is not permissible.
T
F
10.
The Rust compiler can automatically detect and prevent deadlocks from
occurring.
T
F
11.
The
map
function in Python is an example of lazy evaluation.
T
F
Page 2 of 20


Page 3
Programming Languages
Final Exam Solution
ECE326, Fall 2019
Question 2.
Multiple Choices
[23 marks]
Pick all answer(s) that are correct. You will lose 1 mark per wrong choice, down to 0 marks.
a)
For each programming language feature, circle whether C++11, Python, or Rust supports it (more
than one choice is possible). [7 marks]
i.
Default Parameter
C++11
Python
Rust
ii.
Function Overloading
C++11
Python
Rust
iii.
Closure
C++11
Python
Rust
iv.
Return Type Polymorphism
C++11
Python
Rust
*
no marks lost or gained on this choice
v.
Tuple Unpacking
C++11
Python
Rust
b)
Which of the following are higher order functions? [4 marks]
i.
sum
ii.
filter
iii.
decltype
iv.
constexpr
functions
v.
Python decorators
Page 3 of 20


Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
University of Toronto
University_of_Toronto
School:
Programming_Languages
Course:
Great resource for chem class. Had all the past labs and assignments
Leland P.
Santa Clara University
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades

Students also viewed documents