What Does This Haskell Function Do? - Click Quiz - Statistics

General Stats
  • This quiz has been taken 34 times
  • The average score is 7 of 10
Answer Stats
Hint Answer % Correct
f :: [Int] -> [Int]
f = map (*10)
Multiplies every element in a list of integers by 10
88%
f :: Int -> Int
f 0 = 1
f n = n * f (n-1)
Computes the factorial of a number
80%
f :: String -> String
f [] = []
f (x:xs) | isUpper x = x : f xs
| otherwise = f xs
Discards all chars in a string that aren't uppercase letters
80%
f :: Int -> Int
f 1 = 1
f 2 = 1
f n = f (n-1) + f (n-2)
Computes any number in the Fibonacci sequence
76%
f :: [Int] -> Int
f [] = 0
f (x:xs) | even x = x + f xs
| otherwise = f xs
Computes the sum of all even numbers in a list of integers
76%
f :: [Int] -> Int
f [] = 0
f (x:xs) | odd x = x + f xs
| otherwise = f xs
Computes the sum of all odd numbers in a list of integers
76%
f :: Eq a => [a] -> a -> Int
f [] _ = 0
f (x:xs) y | y == x = 1 + f xs y
| otherwise = f xs y
Counts the number of occurrences of a value in a list
72%
f :: Int -> Int -> Maybe Int
f _ 0 = Nothing
f x y = Just (x `div` y)
Performs integer division, with a check for division by zero
72%
f :: Int -> [Int]
f x = [y | y <- [1..x], x `mod` y == 0]
Computes all the factors of an integer
52%
f :: Int -> String
f 0 = "0"
f 1 = "1"
f n = f (n `div` 2) ++ f (n `mod` 2)
Returns the binary representation of a number
44%
No matching quizzes found
Score Distribution
Percent of People with Each Score
Percentile by Number Answered
Your Score History
You have not taken this quiz