prxd33
Quiz by , created more than 1 year ago

Functional Programming Quiz on Functional Programming PT1, created by prxd33 on 25/01/2014.

98
0
0
prxd33
Created by prxd33 over 10 years ago
Close

Functional Programming PT1

Question 1 of 11

1

let x = 2 in let y = -2 in if x^2==y^2 then 1 else 2

Select one of the following:

  • 1

  • 2

  • 3

  • 4

  • 5

Explanation

Question 2 of 11

1

length (words ("One Two Three" ++ "Four"))

Select one of the following:

  • 1

  • 2

  • 3

  • 4

  • 5

Explanation

Question 3 of 11

1

23 `mod` 8 `mod` 5

Select one of the following:

  • 1

  • 2

  • 3

  • 4

  • 5

Explanation

Question 4 of 11

1

head (tail [3,4,5])

Select one of the following:

  • 1

  • 2

  • 3

  • 4

  • 5

Explanation

Question 5 of 11

1

let x = x+3 in fst (snd (x+1,(5,x-2)))

Select one of the following:

  • 1

  • 2

  • 3

  • 4

  • 5

Explanation

Question 6 of 11

1

xs = [1,2,3,4,5]
take 3 xs

Select one or more of the following:

  • reverse (tail (reverse (tail xs)))

  • tail (tail (tail xs))

  • reverse (tail (tail (reverse xs)))

  • reverse (drop 2 (reverse xs))

  • reverse (reverse (take 3 xs))

Explanation

Question 7 of 11

1

xs = [1,2,3,4,5]
take 3 xs

Select one or more of the following:

  • reverse (tail (reverse (tail xs)))

  • tail (tail (tail xs))

  • reverse (tail (tail (reverse xs)))

  • reverse (drop 2 (reverse xs))

  • reverse (reverse (take 3 xs))

Explanation

Question 8 of 11

1

ys = [1,2,3,4]
last (init ys)

Select one or more of the following:

  • fst (drop 2 ys)

  • reverse (init ys)

  • fst (drop 1 (reverse ys))

  • head (drop 2 ys)

  • snd (drop 2 (reverse ys))

Explanation

Question 9 of 11

1

xs = [1,2,3,4,5,6]
reverse (init xs)

Select one or more of the following:

  • reverse (tail xs)

  • tail (reverse xs)

  • reverse (take 5 xs)

  • reverse (drop 1 xs)

  • drop 1 (reverse xs)

Explanation

Question 10 of 11

1

ys = [1,2,3,4,5]
init (init (init ys))

Select one or more of the following:

  • take 2 ys

  • take 3 ys

  • drop 3 (reverse ys)

  • reverse (drop 3 (reverse ys))

  • reverse (tail (reverse (init ys)))

Explanation

Question 11 of 11

1

What is the standard prelude?

Select one or more of the following:

  • Contains predefined classes, types and functions, implicitly imported into every Haskell program.

  • Contains advanced I/O functions.

Explanation