Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. What is ans bound to after the following ML code is evaluated? 2. Given these

ID: 3600287 • Letter: 1

Question

1. What is ans bound to after the following ML code is evaluated?

2. Given these type synonyms three of the types below are interchangeable with each other. Which one is not?

3. If the ML function foo has type 'a list -> bool, which of the following function calls are legal?

a.) val ans = foo(true)

b.) val ans = foo([1, 2, 3])

c.) val ans = foo(NONE)

d.) val ans = foo(SOME 5)

e.) val ans = foo("string")

f.) val ans = foo(["cat", "dog", "horse"])

g.) val ans = foo([true, false, true])

h.) val ans = foo(5)

4. Given this datatype binding:

What is the ML statement that will declare a binding for a variable named myDay of type days with a value of Sunday?

5. What is the result of evaluating this ML expression?

Explanation / Answer

import java.io.File; importjava.io.IOException; public class RenameFile { public static void main(String[] args) { try // Here F is the object of the Existing file named with Includehelp which is to be renamed. // { File F=new File("f:/Includehelp.txt"); // Here T is the object of the renamed file of Includehelp which is Include.txt. // File T=new File ("f:/Include.txt"); // Rename the file Includehelp.txt into Include.txt. // F.renameTo(T); // Print the result if file renamed. // System.out.println("File Rename Successfully..."); } // If any error occurs while renaming the file. // catch(Exception e) { System.out.println(e); } } }