MTH792P: Financial Data Analytics

Duration: 2 hours

Apart from this page, you are not permitted to read the contents of this question paper until instructed to do so by an invigilator.

You should attempt ALL questions. Marks available are shown next to the questions.

Calculators are not permitted in this examination. The unauthorised use of a calculator constitutes an examination offence.

Complete all rough work in the answer book and cross through any work that is not to be assessed.

Possession of unauthorised material at any time when under examination conditions is an assessment offence and can lead to expulsion from QMUL. Check now to ensure you do not have any unauthorised notes, mobile phones, smartwatches or unauthorised electronic devices on your person. If you do, raise your hand and give them to an invigilator immediately.

It is also an offence to have any writing of any kind on your person, including on your body. If you are found to have hidden unauthorised material elsewhere, including toilets and cloakrooms, it will be treated as being found in your possession. Unauthorised material found on your mobile phone or other electronic device will be considered the same as being in possession of paper notes. A mobile phone that causes a disruption in the exam is also an assessment offence.

Exam papers must not be removed from the examination room.

Examiners: Dr Sebastian del Bano Rollin and Michael Phillips

c© Queen Mary University of London (2019) Turn Over



Page 2 MTH792P (2019)

Please write legible answers. Illegible text cannot be graded.

Question 1. [25 marks]

(a) What is the difference between a VBA function and a VBA subroutine? Give an example of a function and an example of a subroutine (just the names, any input/output, and what they do; no need to write any VBA code). [5]

(b) Explain what an Excel slicer is and describe a simple application. [5]

(c) What is a variable declaration in VBA? Give an example. [5]

(d) What is data validation and what is it needed for? Give some lines of VBA that you would insert in your VBA code in order to perform some data validation. [5]

(e) Find three errors in the following VBA code and explain how to fix them: [5]

c© Queen Mary University of London (2019)



MTH792P (2019) Page 3

Question 2. [25 marks]

(a) Describe in 4 lines the meaning and use of CVA and DVA. [5]

(b) What is data wrangling? [5]

(c) What are the downsides of EUC? [5]

(d) What is the Reddick notation? [5]

(e) What does the C.R.U.D. acronym stand for? Provide two SQL keywords that refer to two of the letters in this acronym. [5]

Question 3. [25 marks]

(a) Assume you are given a Pandas dataframe named SandP500 containing a column called ’Close’. What Python instruction would you use to add a new column called ’LogReturns’ containing the log-returns of the column ’Close’? [5]

(b) Suppose x is a dataframe containing columns named a, b, c and d. What is x[[a,b]]? [5]

(c) Explain what a Python namespace is and why it is useful. [5]

(d) What is a method of a Python object? Give an example of a method for an object of class Dataframe. [5]

(e) Suppose x is a dataframe with a text column named a and several other columns. How can you subset (=select) the rows where the column a is equal to ’hello’? [5]

c© Queen Mary University of London (2019) Turn Over



Page 4 MTH792P (2019)

Question 4. [25 marks]

(a) What do the SQL instructions DELETE FROM Counterparties; and DROP Counterparties; achieve? How are they different? [5]

(b) Suppose you have a table named GBPEURTrades, containing columns TradeID, TradeType, Strike, Notional, and CounterpartyID. What SQL instruction would you use to display the TradeType and Notional of all trades with Strike greater than 1.17? [5]

(c) What does the following R code achieve? NormalNumbers <- rnorm(365)

Sums <- cumsum(NormalNumbers)

plot(Sums, type=”l”)

Describe what each line of code accomplishes. If you replace the number 365 above by 4, can you provide a sample of what each of the vectors in this code would hold? [5]

(d) What R instruction did we use to retrieve market data from Yahoo Finance. In what library does it reside? [5]

(e) What are named arguments in R? Give an example. [5]

End of Paper.

Open chat