Final Exam Sample Answers
Final Exam Sample Answers
Name:
Student ID:
Signature:
Lab Section: Day: Hour/Tile:
READ CAREFULLY:
Except for Project Milestone 4, is there any mark missing for any of your lab,
quiz, midterm, assignment, …? If yes, please write here even if you have already
told/slack me.
About the Exam
• This is a closed book exam. You are not allowed to use anything beyond
your cheat sheet.
• Please make sure to close any communication app on your laptop
(discord, slack, WhatsApp, …) during the exam.
• There are 35 multi-choice questions and 2 written questions.
• The Multiple-choice questions worth 60% and the written questions worth
40%.
• Enter the answers for the multiple-choice questions in the table below
and enter your answers for other questions in the designated areas.
• No question is answered during the exam regarding the questions. If you
need to make any assumptions, please write down your assumptions in
the designated areas and then answer the question.
• If you find something is missing or wrong in a question, please just add
comments about it and answer the question. No need to ask about it
during the exam.
• No need to hand in your “cheat-note” at the end of the exam.
• Submit this word document (no need to make pdf) to D2L.
Best of Luck
And
Happy Holiday
Add your answers here: Please Add a dark big X for the correct answer(s)
Question A B C D E F G H
SAMPLE X X
1 X
2 X
3 X
4 X
5 X
6 X
7 X X
8 X
9 X X
10 X
11 X
12 X
13 X
14 X
15 X
16 X
17 X
18 X
19 X X
20 X
21 X X
22 X
23 X
24 X
25 X
26 X
27 X
28 X
29 X
30 X
31 X
32 X
33 X
34 X
35 X
Assumptions:
If you have to make some assumptions to answer any of the questions above, add them here.
Answer for Question 36: (20 mark)
Query1:
Return a list with the number of events each user has attended in descending order of
the number of events. This query should return a table with two columns, one for user id
and one for the number of events attended by that user. Users who have not attended
any events can be ignored.
Query2:
Find the total number of users where the nationality of their significant other has at least
three people. That is to say, the system has recorded at least three users of that
nationality including the significant other. This query should return a table containing a
single column which has a single numerical tuple.
SELECT COUNT(*)
FROM User A, User B
WHERE A.significantOther = B.id AND B.nationality IN (
)
Answer for Question 37: (20 mark)