Final Exam
Instructions:
• Time allowed: 3 hours
Copyright By PowCoder代写 加微信 powcoder
• Total marks available: 100 marks
• The final exam is to be completed individually. You must not collaborate with other individuals
(students or not).
• Section 1: Multiple choice
– All multiple-choice questions are graded on a correct/incorrect basis. There is no penalty for
answering a multiple-choice question incorrectly.
– Ensure that this PDF is for your UNSW ZId. We will not be able to correct marks should
you use the wrong exam paper.
– Unless otherwise specified, each question is independent of the others and assumptions from one
question do not carry over to the others.
– Submit your answers through Ed in the “Multiple choice response” slide. Each question has a
Python variable assigned to it. Assign a string with your answer to the question variable. For
example, to answer b for question 24, use the code q24 = “c”. Ed has been prepulated with
variable names to save you time.
– Click on Mark in Ed to save your progress and submit your answers. Your responses will not
be recorded if you fail to click on Mark.
• Section 2: Coding challenges
– You must complete all code challenges in ED
• Section 3: Short answers
– Please make sure you submit your answers before the end of the exam.
Question 1
You have a list of items and want to create a new list in which instances with the same value only appear
once. That is, if a == b then either a or b, but not both, are in the resulting list. Which of the following
routines will not produce such a list from an original list lst:
a. list(set(lst))
b. list({item for item in lst})
c. [item for item in {item for item in lst}]
d. All of the above will produce such a list
Question 2
Let a and b be integers (of type int) with absolute values less than 10,000. Consider the following code:
for _ in range(0, 9999999):
A colleague asserts that after execution, x == a will always evaluate to True. Is your colleague’s statement
true or false?
Question 3
Consider the following code:
Which of the following values of t will result in the value of x being 1?
b. [False]
d. All of the above. Further, most Python programmers recommend using if t is True.
Question 4
Consider an event study analysing the stock market reaction to certain corporate events. Which of the
following options best describes the appropriate null hypothesis?
a. The event has no effect on raw, non-market adjusted stock returns.
b. The event will have either a positive or negative effect on raw, non-market adjusted stock returns.
c. The event has no effect on market-adjusted stock returns.
d. The event will have either a positive or negative effect on market-adjusted stock returns.
Question 5
At the point indicated in the code below by the # >> line, which of the following variables does not refer to
an object instance:
msg = “Hello world”
func = print
d. None of the above
Question 6
Suppose two data frames, df1 and df2, have (row) indexes of the same size (so len(df1) == len(df2))
and no column label in common. Let df3 = df1.join(df2, how=’inner’) and df4 = df2.join(df1,
how=’inner’). Then df3.index and df4.index will have the same number of elements (in other words,
len(df3) == len(df4)).
Instructions:
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com