COMPSCI 3S Study Guide - Final Guide: List Of Actors With Academy Award Nominations, Pattern Matching

20 views7 pages
8 Jan 2019
School
Professor
file:///C|/Documents%20and%20Settings/Jason%20Raftery/My%20Doc...ce%203%20-%20Spring%201993%20-%20Clancy%20-%20Final%20Exam.htm
CS 3 (Clancy) Final exam
May 17, 1993
THIS COPY HAS ANSWERS DISPLAYED.
Read and fill in this page now.
Do NOT turn the page until you are told to do so.
Your name:
(please print last name, first name) Name of the person sitting to your left:
Name of the person sitting to your right:
Total: /60
Problem 0
Problem 1
Problem 2
Problem 3
Problem 4
Problem 5
Problem 6
This is an open-book test. You have approximately three hours to complete it; time estimates
accompanying each problem suggest a pace to finish in three hours. You may consult any books, notes, or
inanimate objects other than Lisp interpreters available to you. To avoid confusion, read the problems
carefully. If you find it hard to understand a problem, ask us to explain it. If you have a question during
the test, please come to the front or the side of the room to ask it.
This exam comprises 30% of the points on which your final grade will be based. Partial credit will be
given for wrong answers. You are not to use setf within functions. Any other Lisp construct described in
Touretzky chapters 1-8, any of the case studies, or any of the CS3 handouts is ok, though. In particular,
either recursion or applicative operators is allowed in a solution unless otherwise specified. Anywhere you
are directed to write a function, your solution may include auxiliary functions. You need not rewrite a
function that appears in Touretzky, in any of the case studies, or in any of the CS 3 handouts; merely cite
the page in Touretzky, the case study and page number or appendix, or the handout in which the function
appears.
Your exam should contain 6 problems (numbered 0 through 6) on 13 pages. Please write your answers in
the spaces provided in the test; in par- ticular, we will not grade anything on the back of an exam page
unless we are clearly told on the front of the page to look there. Relax! this exam is not worth having heart
failure about.
Problem 0 (3 points, 5 minutes)
You earn the points for this problem if you have done the following:
you have put your name on each page of this exam, and provided the information requested on the first
page;
file:///C|/Documents%20and%20Settings/Jason%20Rafte...20Spring%201993%20-%20Clancy%20-%20Final%20Exam.htm (1 of 7)1/27/2007 6:25:12 PM
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 7 pages and 3 million more documents.

Already have an account? Log in
file:///C|/Documents%20and%20Settings/Jason%20Raftery/My%20Doc...ce%203%20-%20Spring%201993%20-%20Clancy%20-%20Final%20Exam.htm
you have completed and handed in the CS 3 Final Survey (handed out in lecture; copies of the latter are
available from Mike Clancy or the t.a.s);
you have completed an interview.
Check with Mike Clancy or the t.a.s to make sure your survey submission and your interview have been
recorded.
Background for problems 1 and 2
Problems 1 and 2 refer to a state results list. The elements of a legal state results list are themselves three-
element lists of the following form:
the first element is an atom, the name of the state (multi-word names are combined with hyphens, as in
new-york or south-dakota);
the second element is the number of electoral votes from the state (how many senators and
congresspeople it has);
the third element is an atom, the last name of the candidate that won the electoral votes from the state.
The empty list is a legal state results list. A legal state results list also has at most one entry for each state.
An example is the following.
((california 54 clinton)
(new-york 33 clinton)
(texas 32 bush)
(illinois 22 clinton)
(florida 25 bush)
(ohio 21 clinton)
(pennsylvania 23 clinton) )
Problem 1 (5 points, 15 minutes)
Consider the following code. (Assume that remove-duplicates returns the result of removing duplicate
elements from its input.)
(defun mystery1 (state-results-list)
(mystery2 (mapcar #'third state-results-list)) )
(defun mystery2 (name-list)
(defun mystery3 (name1)
(length
(remove-if-not
#'(lambda (name2) (equal name1 name2))
name-list) ) )
(mapcar
#'(lambda (name) (list name (mystery3 name)))
(remove-duplicates name-list) ) )
file:///C|/Documents%20and%20Settings/Jason%20Rafte...20Spring%201993%20-%20Clancy%20-%20Final%20Exam.htm (2 of 7)1/27/2007 6:25:12 PM
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 7 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Do not turn the page until you are told to do so. Your name: (please print last name, first name) name of the person sitting to your left: Name of the person sitting to your right: You have approximately three hours to complete it; time estimates accompanying each problem suggest a pace to finish in three hours. You may consult any books, notes, or inanimate objects other than lisp interpreters available to you. If you find it hard to understand a problem, ask us to explain it. If you have a question during the test, please come to the front or the side of the room to ask it. This exam comprises 30% of the points on which your final grade will be based. Partial credit will be given for wrong answers. You are not to use setf within functions. Touretzky chapters 1-8, any of the case studies, or any of the cs3 handouts is ok, though.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents