[3] 6. The LISP function mapcar applies its first argument (a function) to each element of its second argument (a list), returning a list of the results. What is the result of evaluating the following function call?
(mapcar (lambda (x) (* x 2)) '(1 2 3))
[4] 7. A C++ array is declared by
int A[3][4];
Assuming a byte-addressable architecture using 32-bit (4 byte) integers and that element A[1][2] is stored at address 2400, at which address is element A[2][1] located? (Remember: C++ uses zero-based, row-major array indexing.)
At which address is element A[i][j] located? (I.e., give the addressing formula for this array in terms of variables i and j, using as many actual numbers as possible.)
4. Indicate one disadvantage of each of the following methods of storage reclamation.
a) explicit disposal
b) reference counting
c) mark-sweep garbage collection
[3] 6. Distinguish between keywords (as used in Algol), reserved words (as used in Pascal), and keywords in context (as used in FORTRAN).
[2] 7. What is the primary difference between a begin-end pair in Algol and the same construct in Pascal?
[3] 8. Describe the similarities and differences between blocks in Algol and the EQUIVALENCE statement in FORTRAN. What is the primary advantage of the former construct over the latter?
[3] 9. What is the difference between compilation and interpretation? What are the relative advantages of each method of translation?
[2] 10. How is a procedural parameter passed so as to preserve static scoping?
[3] 11. Describe three solutions to the dangling else problem.
[2] 16. Is it possible for a compiler to know the amount of space needed for executing a Fortran program? An Algol program? Why?
[1] 17. Why did the designers of Fortran and LISP include aliasing as a feature in those languages?
[12] 8. SHORT ANSWER -- Answer any four of the following questions concisely but completely in the space below, continuing on the separately provided answer pages as necessary. Label continuations clearly. Indicate clearly which four questions you are answering. The questions are worth three points each.