Functional Programming PT1

Description

Functional Programming Quiz on Functional Programming PT1, created by prxd33 on 25/01/2014.
prxd33
Quiz by prxd33, updated more than 1 year ago
prxd33
Created by prxd33 over 10 years ago
98
0

Resource summary

Question 1

Question
let x = 2 in let y = -2 in if x^2==y^2 then 1 else 2
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 2

Question
length (words ("One Two Three" ++ "Four"))
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 3

Question
23 `mod` 8 `mod` 5
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 4

Question
head (tail [3,4,5])
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 5

Question
let x = x+3 in fst (snd (x+1,(5,x-2)))
Answer
  • 1
  • 2
  • 3
  • 4
  • 5

Question 6

Question
xs = [1,2,3,4,5] take 3 xs
Answer
  • reverse (tail (reverse (tail xs)))
  • tail (tail (tail xs))
  • reverse (tail (tail (reverse xs)))
  • reverse (drop 2 (reverse xs))
  • reverse (reverse (take 3 xs))

Question 7

Question
xs = [1,2,3,4,5] take 3 xs
Answer
  • reverse (tail (reverse (tail xs)))
  • tail (tail (tail xs))
  • reverse (tail (tail (reverse xs)))
  • reverse (drop 2 (reverse xs))
  • reverse (reverse (take 3 xs))

Question 8

Question
ys = [1,2,3,4] last (init ys)
Answer
  • fst (drop 2 ys)
  • reverse (init ys)
  • fst (drop 1 (reverse ys))
  • head (drop 2 ys)
  • snd (drop 2 (reverse ys))

Question 9

Question
xs = [1,2,3,4,5,6] reverse (init xs)
Answer
  • reverse (tail xs)
  • tail (reverse xs)
  • reverse (take 5 xs)
  • reverse (drop 1 xs)
  • drop 1 (reverse xs)

Question 10

Question
ys = [1,2,3,4,5] init (init (init ys))
Answer
  • take 2 ys
  • take 3 ys
  • drop 3 (reverse ys)
  • reverse (drop 3 (reverse ys))
  • reverse (tail (reverse (init ys)))

Question 11

Question
What is the standard prelude?
Answer
  • Contains predefined classes, types and functions, implicitly imported into every Haskell program.
  • Contains advanced I/O functions.
Show full summary Hide full summary

Similar

Starting Out Haskell
Manuel Felipe Del Toro
OCR Chemistry - Atoms, Bonds and Groups (Definitions)
GwynsM
The Great Gatsby - Theme
Heather Taylor
WAVES
toritorx
OCR GCSE Latin Vocab flash cards - all
jess99
IB Biology Topic 4 Genetics (SL)
R S
Matematica para concursos
Luiz Ricardo Oliveira
untitled 2
lola_smily
GCSE REVISION TIMETABLE
Sonia Christopher
Answering Unseen Poetry questions
mcglynnsiobhan
Grammar Rules
Sandra Yeadon