Sample Haskell Handson Exam

For this handson exam, you are allowed to access only the notes and haskell programs that we have used in class lectures and exercises, nothing else.
  1. (25 points) Write a mean function that takes a list of numbers and computes the average of the numbers in that list. For example:
    mean [3,5.5,2,2.3] => 3.2
    
  2. (35 points) Write a stdev function that takes a list of numbers and computes the standard deviation of that list. Standard deviation is defined as the square root of the average of the squares of the differences of each element from the mean. For example:
    stdev [8,1,3,3,5] => 2.366
    
    Note that the mean of the list given above is 4; the differences are 4,3,1,1, and 1; the squares of the differences are 16,9,1,1 and 1; the average of these squares is 28/5 = 5.6; and the squareroot of this average is 2.366.

  3. (40 points) Write a match function that takes two lists of integers as arguments. Each of these lists are sorted in increasing order, and you may assume that there are no repeating elements in each list. The function returns a list all elements that are common to both lists. For example:
    match [1,3,4,6,10,12,100] [2,6,8,12,50,100,200] => [6,12,100]