Question: Question 4 (1.5 points) Which of the ML code below correctly implements the following definition of the function cube: Write a function cube of type

 Question 4 (1.5 points) Which of the ML code below correctly
implements the following definition of the function cube: Write a function cube
of type int -> int that returns the cube of its parameter.

Question 4 (1.5 points) Which of the ML code below correctly implements the following definition of the function cube: Write a function cube of type int -> int that returns the cube of its parameter. O fun cube x = cube (x); fun cube x = x + x + x; O fun cube x = x * cube (x-1); * fun cube x = * x; Question 5 (1.5 points) Which of the ML code below correctly implements the following definition of the function duplicate: Write a function duplicate of type string => string that returns the duplicate of its parameter such that duplicate "go" evaluates to "gogo". Question 5 (1.5 points) Which of the ML code below correctly implements the following definition of the function duplicate: Write a function duplicate of type string => string that returns the duplicate of its parameter such that duplicate "go" evaluates to "gogo". fun duplicate s = s@s; fun duplicate s = sas; fun duplicate s = s^s^s^s; fun duplicate s = substring(s, size s div 2,1); Question 6 (1.5 points) Which of the ML code below correctly implements the following definition of the function cuber: Write a function cuber of type real -> real that returns the cube of its parameter. fun cube x - x * x * x :: real; fun cube (x:real):real = x * cube (x-1); fun cube x = * x X; O fun cuber (x: real): real = x * x X

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!