Problem 1 (15 points) Pyret expressions. Given a series of Pyret expressions, indicate either what each expression evaluates to, or whether it results in an error. Expressions may involve:
values of type Number, String, Boolean (no Image values)
functions that take and return those types of values
operations/operators over those types of values
parenthesized expressions
named values of the form NAME = EXPRESSION
if-else, and if-else if-else expressions
Problem 2 (10 points) Fixing a function. Given a function with problems, identify and fix the problems.
identifying the problems may involve carefully reading the function header, docstring, examples, and body of the function
if the body and/or tests don't match the behavior described in the docstring, fix whatever is wrong so they do
Problem 3 (10 points) Incomplete function: missing examples in where: clause.
fill in missing examples–enough to fully test the function
Problem 4 (10 points) Incomplete function: missing body.
this time you are given the where“ clause for a function, but the rest of the function is missing!
fill in the missing function header, docstring, and function body
Problem 5 (10 points) Reading and understanding code. Given a function:
indicate which tests pass or fail
briefly describe (in words, not code) what you would need to change to make all of the tests pass
Problem 6 (20 points) Table Processing. Multi-part question. Given a table, and a function that takes a row from the table:
a. (2 points) fill in the expected return values in the where clause of the function
b. (3 points) write the docstring for the function
c. (4 points) write an expression to access the value in a particular row and column of the table
d. (6 points) write an expression that involves some form of table processing to compute/locate a particular value within the table
e. (6 points) given a table expression, show the resulting table
f. (8 points) write a predicate function that takes a row of the table and determines whether that row satisfies (returns true) the given criteria.