Question: can someone help me answer the following #Fsharp multiple choice questions along with explanations for each question please. 1. What type does F# infer for
can someone help me answer the following #Fsharp multiple choice questions along with explanations for each question please.
1. What type does F# infer for the expression fun x y -> x+y+"." ? Select one:
A. string -> string -> string
B.string * string -> string
C. Type error.
D. int -> int -> string
2. What type does F# infer for the expression fun xs -> List.map (+) xs ? Select one:
A. int list -> int -> int list
B. int list -> int list
C. Type error.
D. int list -> (int -> int) list
3. Which of the following does F# infer to have type string -> string -> string ? Select one:
A. fun x -> fun y -> x y "."
B. fun x y -> String.length x * String.length y
C. fun (x, y) -> x + y + "."
D. (+)
4. Which of the following does F# infer to have type (string -> string) -> string ? Select one:
A. fun f -> String.length (f "cat")
B. fun x y -> x + " " + y
C. fun f -> f (f "cat")
D. fun f -> f "cat"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
