wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AFP Midtvejsevaluering

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Result of:

[-2;3;5] |> List.map (fun x -> x*2)

a)

val it : int list = [-4; 6; 10]

b)

val it : float list = [-4.0; 6.0; 10.0]

c)

error FS0001: The type 'float' does not match the type 'int'

d)

val it: int list = []

2.

F# is

a)

General purpose language with roots in FP

b)

Functional first language with strong types, support imperative, FP and OOP

c)

Purely functional with strong types

d)

General purpose language with support of OOP and FP

3.

Which is the higher order function(s) in F#

a)

'a -> int -> 'b -> float option list

b)

'a -> 'b -> ('c -> int)

c)

('a -> int) -> 'c

d)

('a -> int) -> ('b -> 'c) -> ('d -> float)

4.

F# is lazy evaluated

a)

True

b)

False

c)

Some

d)

None

5.

Which is the polymorphic function(s) in F#

a)

(int -> float) -> int option -> float option

b)

int -> int list

c)

('a -> 'b) -> 'a -> 'b

d)

int -> 'a list

6.

Type of:

[1;2;3;4] |> List.fold (fun a b -> a + string b) ""

a)

val it : string list

b)

val it : string

c)

val it : int

d)

val it : int list

7.

Result of:

[1;2;3;4] |> List.fold (fun a b -> string (int a + b)) "0"

a)

"0"

b)

"10"

c)

"11"

d)

"1234"

8.

Worst-case runtime of sets N and M:

Set.isSubset (set [1;2;3]) (set [2;3])

a)

O(M*log(N))

b)

O(N*M)

c)

O(N+M)

d)

O(N)

9.

Result of:

Some "a" |> Option.fold (fun a b -> "b" + b + a) ""

a)

"ba"

b)

"b"

c)

"bba"

d)

"a"

10.

Ouput of:

Seq.item 5 (Seq.cache (Seq.initInfinite (fun i -> printf "%i" i)))

a)

"1\n2\n3\n4\n5"

b)

"123456"

c)

"1234"

d)

"12345"