Haskell — Vel Tech Exam 2018

  1. Write a function df :: Int -> Int that returns the double factorial of a natural number. The double factorial of nn is denoted n!!n!! and is n(n2)(n4)n(n-2)(n-4)\dots.

  2. Write a function sumd :: Int -> Int that returns the sum of the digits of a natural number.

  3. Write a function dup :: [Int] -> [Int] that duplicates each element in a list.

  4. Write a function pal :: String -> Bool that tells if a string is a palindrome, ie, if it is equal to its reverse.

  5. Write a function apply2 :: (a -> a) -> a -> a that applies a function twice to some parameter.

Problem information

Author: Jordi Petit

Generation: 2026-02-03T17:01:44.383Z

© Jutge.org, 2006–2026.
https://jutge.org