COMS10016: Imperative and Functional ProgrammingFunctional Programming
Basic Information
Duration: 2 hours
Weight: 50% of the course grade
Location: Online (Open book)
Feel free to use books/notes/slides/internet/GHCi
But no collaboration with another person!
Format: Randomized MCQs
Topics to be tested
Evaluation
Pattern Matching
Type classes
List comprehensions
Higher order functions
QuickCheck
IO/Monad/Applicative/Functor
Paper Contents
20 MCQs (8 Easy, 10 Medium, 2 Hard)
“Easy” Question
20 MCQs (8 Easy, 10 Medium, 2 Hard)
Which of the following defines a new data type?
a. `data D = D` (*)
b. `type D = Int`
c. `data D = Int`
d. `newtype D = Int`
d. None of the above.
“Medium” Question
20 MCQs (8 Easy, 10 Medium, 2 Hard)
What is a type that is suitable for representing a grid of `a`-typed elements?
a. `String`
b. `Either a`
c. `[[a]]` (*)
d. `([a],[a])`
e. None of the above.
“Hard” Question
20 MCQs (8 Easy, 10 Medium, 2 Hard)
Which of the following definitions can be expressed using `foldr`?
f p [] = []
f p (x:xs)
| p x = x : f p xs
| otherwise = f p xs
f (xs:xss) = xs ++ f xss
“Hard” Question
20 MCQs (8 Easy, 10 Medium, 2 Hard)
Which of the following definitions can be expressed using `foldr`?
f (x:xs) = x + f xs
d. All of the above. (*)
e. None of the above.
Lab this week is on Monad
Lab next week (wk 12) will dedicated for reviewing.
Reviewing (in the order of importance)
Slides, notes, Lab sheets, Practical Assignments, Optional Formative sheets, Text Books