


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A practice test for Programming Languages course in Fall 2016. It is 4 pages long and includes short-answer questions. The test is closed books, notes, papers, friends, neighbors, etc. The first question is about first-class functions, the second question is about an ML program that violates the value restriction and its equivalent program, and the third question is about implementing a function filter in ML syntax without calling any built-in higher-order functions.
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Instructions:
This test is 4 pages in length.
You have 75 minutes to complete and turn in this test.
Short-answer questions include a guideline for how many sentences to write. Respond in complete English sentences.
This test is closed books, notes, papers, friends, neighbors, etc.
Use the backs of pages in this test packet for scratch work. If you write more than a final answer in the area next to a question, circle your final answer.
Write and sign the following: “I pledge my Honor that I have not cheated, and will not cheat, on this test.”
Signed: ______________________________________________
What are first-class functions? [1-2 sentences]
b) Rewrite your example from Part (a) into an equivalent program that does not violate the value restriction.
b) What type does filter have?
a) Define inference rules for greater-than and less-than judgments over natural numbers. The judgment forms are: N 1 >N 2 and N 1 <N 2. Recall that N 1 and N 2 , being natural numbers, adhere to our definition of natural numbers (N nat), as discussed in class.
b) Using your definitions of greater-than and less-than, prove that for all natural numbers N 1 and N 2 : (N 1 >N 2 ) if and only if (N 2 <N 1 ).
c) Prove that your less-than operator is transitive , i.e., for all natural numbers N 1 , N 2 , and N 3 : if N 1 <N 2 and N 2 <N 3 then N 1 <N 3.