ECOR 1042 CD - Mock Final
ECOR 1042 CD - Mock Final
ECOR 1042 CD
It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This
means:
Complete the midterm in 1 hour and 30 minutes.
Work on your own and attempt every question.
Keep your notes and textbook closed.
After the time limit, go back over your work with a different colour or on a separate piece of
paper and try to do the questions you are unsure of. Record your ideas in the margins to remind
yourself of what you were thinking when you take it up at PASS.
The purpose of this mock exam is to give you practice answering questions in a timed setting
and to help you to gauge which aspects of the course content you know well, and which are in
need of further development and review. Use this mock exam as a learning tool in preparing for
the actual exam.
Please note:
Complete the mock exam before attending the take-up session. During the session you
can work with other students to review your work.
Often, there is not enough time to review the entire exam in the PASS workshop. Decide
which questions you want to review the most – the Facilitator may ask students to vote
on which questions they want to discuss in detail.
Facilitators will not distribute an answer key for mock exams. The Facilitator’s role is to
help students work together to compare and assess the answers they have. If you are
not able to attend the PASS workshop, you can work alone or with others in the class.
PASS worksheets and mock exams are designed as a study aid only for use in PASS
workshops. Worksheets and mock exams may contain errors, intentional or otherwise. It
is up to the student to verify the information contained within by attending the PASS
workshop.
Good Luck writing the Mock Exam!
1
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
Table of Contents
Multiple Choice Questions (30 min).........................................................................................3
Coding (1 hour)........................................................................................................................8
Part 1 (20 min): Implement function run_ui()....................................................................................9
Part 2 (20 min): Implement function load_movies()........................................................................10
Part 3 (20 min): Implement function plot_bar_ticket_sales()..........................................................11
Further Studies......................................................................................................................11
References.............................................................................................................................11
Hey! Thanks for doing this mock. You rock. Good luck.
1. Suppose you are writing a program with the first line import math. Select all the correct
ways to call the function sqrt().
a. sqrt()
b. m.sqrt()
c. math.sqrt()
d. None of the above
2. True or false, you can use the ‘==’ operator to check if a float value is equal to a certain
number.
a. True
b. False
Discussion: Justify your answer.
3. Select all that are true, which of the following aggregate types is aliasing a hazard for?
a. String
b. List
c. Set
d. Tuple
4. Select all that are true, which of the following aggregate types allow duplicates?
a. String
b. Set
c. Tuple
2
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
d. Dictionary Keys
5. Select all that are true, which of the following are correct ways to initialize a set?
a. my_set = {}
b. my_set = ()
c. my_set = []
d. None of the above
6. Select all that are true, which of the following are correct ways to initialize a tuple?
a. my_tuple = (1)
b. my_tuple = (1,)
c. my_tuple = (1,2)
d. None of the above
3
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
10. For the list [6, 5, 7, 4, 9, 8], what is the order of its contents after three swaps of an
ascending bubble sort.
a. [4, 5, 6, 7, 8, 9]
b. [5, 4, 6, 7, 9, 8]
c. [5, 6, 4, 7, 8, 9]
d. None of the above
4
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
11. For the list [6, 5, 7, 4, 9, 8], what is the order of its contents after three swaps of an
ascending insertion sort.
a. [4, 5, 6, 7, 8, 9]
b. [5, 4, 6, 7, 9, 8]
c. [5, 6, 4, 7, 8, 9]
d. None of the above
12. For the list [6, 5, 7, 4, 9, 8], what is the order of its contents after three swaps of an
ascending selection sort.
a. [4, 5, 6, 7, 8, 9]
b. [5, 4, 6, 7, 9, 8]
c. [5, 6, 4, 7, 8, 9]
d. None of the above
13. For a third-order polynomial, how many data points do we need to calculate the
coefficients?
a. 1
b. 2
c. 3
d. 4
15. For plotting the growth of a population over time, which curve fitting method would you
most likely use?
a. Interpolation
b. Regression
c. Both
d. None of the above
Discussion: Justify your answer.
5
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
18. Which NumPy function would you use to create a list of X values to plot?
a. linspace
b. polyfit
c. polyval
d. plot
19. Which NumPy function would you use to find the coefficients for a polynomial
interpolation of a set of data?
a. linspace
b. polyfit
c. polyval
d. plot
20. True or false, interactive user interfaces are practical for program testing.
a. True
b. False
Discussion: Justify your answer.
Fun fact (Not tested on this): Did the first computers use a batch UI or interactive UI?
21. Which optimization problem involves functions that depend on two or more dependent
variables?
a. Local optimum
b. Global optimum
c. One-dimensional
d. Multi-dimensional
22. Choose the option that describes a bisection search for finding the word ‘pragmatic’ in
the Oxford dictionary.
a. Start at the first word in section ‘A’ and go through each word in the dictionary
until you find ‘pragmatic’.
b. Go to the first word in section ‘P’ and go through each word in the dictionary until
you find ‘pragmatic’.
6
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
c. Start at the last word in the dictionary and go through each word in the dictionary
until you find ‘pragmatic’.
d. Go to the word in the middle of the dictionary (assume it’s the word ‘middle’).
Determine if the word ‘pragmatic’ comes before or after the word ‘middle’ (it
comes after). Go to the word halfway between the word ‘middle’ and the last
word in the dictionary (assume it’s the word ‘vacuum’). Determine if the word
‘vacuum’ comes before or after ‘pragmatic’ …
23. For an initial guess of 0, step size of 1 and epsilon of 3, what is the root for function f(x)
= x^2 – 4 as determined by the root finding algorithm exhaustive enumeration.
a. 1
b. 2
c. 3
d. 4
24. For an initial low bound of 0, initial high bound of 12 and epsilon of 3, what is the root for
the function f(x) = x^2 – 4 as determined by the root finding algorithm bisection search.
a. 1
b. 1.5
c. 2
d. 3
7
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
8
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
“movies.csv”
9
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
10
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)
Further Studies
I strongly urge you to do the problems presented in [1]. The best thing to prepare for this
exam is to code (and go see a movie at the Mayfair Theatre the night before).
If doing all of [1] is not feasible, then I suggest doing it in this order:
1. Write a user interface to handle the various commands
2. Write function load_data()
3. Write function plot_grades()
4. Either function add_student() OR function remove_student()
5. The other functions!
Good luck! If you are reading this, then you are doing the work and have what it takes to pass
this course.
References
11