0% found this document useful (0 votes)
98 views11 pages

ECOR 1042 CD - Mock Final

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views11 pages

ECOR 1042 CD - Mock Final

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Peer Assisted Study Sessions (PASS)

Facilitator: Braeden Kloke (he/him)

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!

Take-up Session #1 : Thursday April 11, 11:35am-1:25pm (ME 3269)

Take-up Session #2 : Friday April 12, 10:35am-12:25pm (ME 3269)

Office Hour: Thursday April 11, 2:35-3:25pm (ML 413)

Contact Information: [email protected]

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

Multiple Choice Questions (30 min)

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

7. What does the following script print?

a. “Fernie”, “Batawa”, “Pictou” (ordered)


b. “Fernie”, “Batawa”, “Pictou” (unordered)
c. Error
d. None of the above

8. What does the following script print?

3
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)

a. “Fernie”, “Batawa”, “Pictou”


b. 5000, 2000, 3000
c. Error
d. None of the above

9. What does the following script print?

a. “Fernie”, “Batawa”, “Pictou”


b. 0, 1, 2
c. Error
d. None of the above

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

14. Which of the following are true for interpolation?


a. Data points have a negligible amount of error.
b. The curve must pass through all the data points.
c. All of the above
d. None of the above

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.

16. What is the correct order of steps for reading a file?


a. Input file, Read each line
b. Open file, Read each line
c. Input file, Read each line, Output file
d. Open file, Read each line, Close file

5
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)

17. Select all str functions used to process input files?


a. strip
b. lower
c. split
d. format

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)

Coding: Mayfair Movie Theatre UI (1 hour)


You task is to code a UI for the Mayfair Movie Theatre. Your UI should be able to (1) load a
CSV file of movies and (2) plot a bar graph of the ticket sales for each genre. Implement the
functions presented in part 1, 2 and 3.
TIP: If you get stuck, DON’T PANIC! Move onto the next function.

Part 1 (20 min): Implement function run_ui()

8
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)

Part 2 (20 min): Implement function load_movies()

“movies.csv”

9
Peer Assisted Study Sessions (PASS)
Facilitator: Braeden Kloke (he/him)

Part 3 (20 min): Implement function plot_bar_ticket_sales()

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

[1] R. Sabouni. (2024). Course Review [PDF]. Available:


https://brightspace.carleton.ca/d2l/le/content/253140/viewContent/3699344/View

[{"StudentNumber":123456, "FirstName": "Jack", "LastName": "Jacob", "FinalGrade": 85},


{"StudentNumber":100001, "FirstName": "Chris", "LastName": "Henry", "FinalGrade": 85},
{"StudentNumber":100000, "FirstName": "Abby", "LastName": "Brock", "FinalGrade": 77.6},
{"StudentNumber":100090, "FirstName": "Logan", "LastName": "Aiden", "FinalGrade": 91 }]

11

You might also like