CMSC330-09/08

CMSC 389A — Fall 2026 · September 08, 2026 · 17 players · Max 6 pts

Questions & Results

Q1 of 6Multiple ChoiceAccuracy60s · 1 pt

What is the value of the OCaml expression if 3 = 5 then 10 else 20

A 3
B 5
C 10
1
D 20
12
✓ Correct
13 / 17 answered · 92% correct
Q2 of 6Multiple ChoiceAccuracy60s · 1 pt

What is the type of the following expression?

if true then 10 else 20

A bool
B int
7
✓ Correct
C unit
D float
7 / 17 answered · 100% correct
Q3 of 6Multiple ChoiceAccuracy60s · 1 pt

What happens when OCaml evaluates the following expression?

if 10=5 then "yes" else 0

A It evaluates to "yes"
B It evaluates to 0
1
C It evaluates to "yes0"
D It produces a type error
✓ Correct
1 / 17 answered · 0% correct
Q4 of 6Multiple ChoiceAccuracy60s · 1 pt

What is the type of the OCaml function? let f x = x + 1

A int -> int
✓ Correct
B int -> float
C float -> int
D int
0 / 17 answered
Q5 of 6Multiple ChoiceAccuracy59s · 1 pt

What is the type of the OCaml function?

let f x y = (x = y)

A int -> int -> bool
B 'a -> 'a -> bool
✓ Correct
C bool -> bool -> bool
D 'a -> 'b -> bool
0 / 17 answered
Q6 of 6Multiple ChoiceAccuracy60s · 1 pt

What does the following OCaml function compute?

let rec f n = if n = 0 then 0 else n + f (n - 1)

A The factorial of n
B The sum of integers from 1 to n
✓ Correct
C n * 2
D The number of integers from 0 to n
1
1 / 17 answered · 0% correct

Score Distribution

2
11
4
0
1
2
3
4
5
6

Score (points) →

Players
17
Average Score
1.1
High Score
2
Max Possible
6