Questions & Results
Q1 of 10Multiple ChoiceAccuracy45s · 1 pt
139 / 179 answered · 78% correct
Q2 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of the OCaml expression?
let r = ref 5 in
r := !r + 1;
!r
D It produces a type error 142 / 179 answered · 96% correct
Q3 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of !a after evaluation?
let a = ref 0 in
let b = a in
b := 42;
!a
C It produces a type error 155 / 179 answered · 80% correct
Q4 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of !a after evaluation?
let a = ref 0 in
let b = ref !a in
b := 42;
!a
C It produces a type error 161 / 179 answered · 98% correct
Q5 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of the OCaml expression?
let a = ref 5
let b = ref 5
a == b
C It produces a type error D It depends on the compiler 168 / 179 answered · 89% correct
Q6 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of the OCaml expression?
let x = ref 0 in
(x := 1; x := !x + 1; !x)
D It produces a type error 170 / 179 answered · 91% correct
Q7 of 10Multiple ChoiceAccuracy60s · 1 pt
Which of the following does the OCaml language specification NOT guarantee?
A The order in which the two arguments to a function application are evaluated✓ Correct B The result of adding two integers C The value that a let binding produces D The type that a well-typed expression has 172 / 179 answered · 84% correct
Q8 of 10Multiple ChoiceAccuracy60s · 1 pt
What is the value of p.x after evaluation?
type point = { mutable x : int; y : int }
let p = { x = 1; y = 2 }
let () = p.x <- p.x + 10
D It produces a type error 174 / 179 answered · 98% correct
Q9 of 10Multiple ChoiceAccuracy45s · 1 pt
What is the value of x after evaluation?
let x = 5 in
let x = x + 1 in
x
D It produces a type error 175 / 179 answered · 87% correct
Q10 of 10Multiple ChoiceAccuracy60s · 1 pt
What is the value of result after evaluating the code?
let count = ref 0;;
let f x =
count := !count + 1;
x * !count;;
let result = [f 1; f 2; f 3];;
D It produces a type error 177 / 179 answered · 12% correct
Score Distribution
Score (points) →