Study Guide for Test on SICP Sections 1.3.2 through 2.2.1 This study guide contains two parts. The first is the actual directions from the test. These will appear on the first page. The second is a list of topics. DIRECTIONS FROM THE FIRST PAGE OF THE TEST For this test, you can use one (1) page (8.5 by 11 inches, one (1) side, no less than 9pt font) of notes. Don't use anything with printing on the other side. No photo-reduction is permitted. You may not share your notes with anyone else during the test. These notes are to be handed in at the end of the test, so please have your name in the upper right hand corner of your notes. Use of other notes or failure to follow these instructions will be considered cheating. WARNING: you won't have time to learn the material on during the test. Just write down what would be too tedious to remember otherwise. If you need more space, use the back of a page. Note when you do that on the front. This test is timed. We will not grade your test if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire test so that you can budget your time. For programs, indentation is important to us for ``clarity'' points; if your code is sloppy or hard to read, you will lose points. Correct syntax also matters. Check your code over for syntax errors. You will lose points if your code has syntax errors. Of course, you may write helping procedures or methods whenever you wish. It may be helpful to give a comment that describes what they do, if it's not completely clear from the name. You may assume that all Java code is in the same package on this test, unless the problem states otherwise. TOPICS FOR THE TEST The problems on the test of the similar to the homework. Study Hint: probably the most helpful thing you can do is to create your own test (perhaps from problems in the textbook that were not assigned), take it on paper, and then type and debug your programs on-line. Topics that are more important are indicated by a +, those are less important by a -. 1. Formulating Abstractions with Higher-order Procedures + You should know what lambda means in Scheme, how it is used to pass procedures as arguments and return procedures as results, and be able to translate that into Java using interfaces, classes that implement them, and function objects. - You should be able to give the result of a "let" expression in Scheme, and should be able to use let in writing Scheme code. - You should be able to use the substitution model (see pages 13-17 in the text) in Scheme to reason about the value of Scheme expressions, especially those involving lambda (as in homework four problem 2). + You should be able to write curried procedures in Scheme and Java (like the homework problems doubled, composed, repeated, smooth). - You should be able to test Java programs that take function objects as arguments. + You should be able to implement an interface in Java with a class. - You should understand package and import declarations in Java. + You should be able to compare Scheme and Java in terms of how well they support formulating abstractions with higher-order procedures. 2. Data Abstraction + You should be able to implement abstract data types in both Scheme and Java (on the homework we had: line segments, points, intervals). + You should be able to choose appropriate privacy levels for fields and methods in Java (as in homework 4). - You should be able to choose the appropriate names for methods in Java (toString is an example). + You should build to compare the support in Scheme and Java for data abstraction (as in homework 4). 3. Writing Recursive Procedures on Lists + You should be able to write procedures to that operate on lists in Scheme (as with last-pair, append, reverse, and square-list). + You should be able to write both linear recursive and tail recursive procedures in Scheme for operating on lists; these generate recursive and iterative processes respectively. We may ask you to use either linear recursion or tail recursion particularly for given problem. - You should be able to use Scheme's "map" procedure to operate on lists. - You should be able to write procedures that use while loops in Java to solve similar problems on lists.