What is the value of the following expression:
match 4 with | S (S x) => x | _ => 0 end.
the correct answer is answer no. 3: 2
What is the value of the following expression:
match 5 with | S (S x) => x | _ => 0 end.the correct answer is answer no. 3: 3
What is the value of the following expression:
match 5 with | S (S x) => x | 0 => 0 end.
the correct answer is answer no. 1:
Error: Non exhaustive pattern matching
In a context where lists have been defined, what is the value of the following expression:
match (1 :: 2 :: 3 :: 4 :: nil) with | _ :: _ :: n :: _ => n | _ => 0 end
the correct answer is answer no. 1: 3
What is the value of the following expression:
(fun (f : nat -> nat) => f 3) (Nat.add 2)
the correct answer is answer no. 1: 5
What is the value of the following expression:
match (4 + 2) with | x + 2 => x | _ => 0 end
the correct answer is answer no. 3:
Error: Invalid notation for pattern
What is the value of the following expression:
match 3, 4 with x, x => x | x, y => x + y end.
the correct answer is answer no. 4:
Error: the variable x is bound several times in pattern
What is the value of the following expression:
(fun x y => match y with 0 => true | x => false end) 3 5the correct answer is answer no. 2: false
Here is the definition of a recursive function:
Fixpoint f (x : nat) : nat := match x with 0 => 0 | 1 => 0 | S p => S (f p) end.What is the value of
f 3
the correct answer is answer no. 2:
2
Here is the definition of a recursive function:
Fixpoint f (x : nat) : nat := match x with 0 => 1 | S p => p * f p end.What is the value of
f 3
the correct answer is answer no. 3:
0
Here is the definition of a recursive function:
Fixpoint f (x : nat) : nat := match x with S (S p) => S (f p) | _ => 0 end.What is the value of
f 3
the correct answer is answer no. 1:
1
What is the value of the following expression:
fun x => match 2 + x with | S (S x) => x | _ => 0 end
the correct answer is answer no. 2:
fun x : nat => x