The exam will consists of 20 MCQs of equal weight. 8 from the “easy” pool, 10 from “medium”, and 2 from “hard”. The questions will be randomised though the difficulty level will be the same for everyone.
The following is are samples of questions from the difference level of difficulties to get you familiarised with the format. It is not meant to be review material. For that you shall use the slides, work sheets, text book etc.
Easy
1. Which of the following defines a new data type? a. dataD=D (*)
b. type D = Int
c. data D = Int
d. newtype D = Int d. None of the above.
Medium
1. 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
1. Which of the following definitions can be expressed using foldr ? a.
f p [] = []
f p (x:xs)
| p x = x : f p xs
| otherwise = f p xs
b.
c.
d. All of the above. (*) e. None of the above.
f [] = []
f (xs:xss) = xs ++ f xss
f [] = 0
f (x:xs) = x + f xs