CS61A_fa93_mt2 - CS60A FALL 1993 Midterm 2 * Do not turn...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS60A FALL 1993 Midterm 2 * Do not turn the page until instructed to do so. * This exam contains five numbered pages including tbe cover page. Put all answers on these pages, please; don't hand in stray pieces of paper. * This is an open book exam. * If, after the exam, you compare your answers with those of your friends, do not panic if their answers were different from yours. Their questions were probably different. Except for this first page, you do not have the same exam pages as your neighbors. * This exarn is worth 20 points, or 10% of your total course grade. The exam contains four substantive questions, plus the following: Question 0 (1 point): Fill out this front page correctly and put your name and login correctly at the top of each of the following pages. Question 1 (4 points): The published solution (homework 5) for deep-reverse is surprisingly short. It is (define (deep-reverse l) (if (atom? l) l (mapcar deep-reverse (reverse l)))) Here are other attempts to program tbe same function. (define (deep-reverse2 l) (if (list? l)(reverse (mapcar (deep-reverse2 l))) l)) (define (deep-reverse3 1) (if (list? l) (reverse (mapcar deep-reverse3 l)) l)) (define (deep-reverse4 l) (if (list? 1)(deep-reverse4 (mapcar reverse l)) l)) What will Scheme print when you try use
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/23/2010 for the course CS 61A taught by Professor Harvey during the Fall '08 term at University of California, Berkeley.

Ask a homework question - tutors are online