Wright State University
Department of Computer Science and Engineering
CS 480/680 Comparative Language

Summer  2008                                Final Examination                                     Prasad


1.   Recursive Definition in Scheme (7 + 6  pts)

Consider the list functions computed by the following Standard (R5RS) Scheme definitions. 

   (define (mystery   lis)
            (if (null? lis) lis
                [if (symbol? (car lis)) (mystery (cdr lis))
                                      '()
                ]
               
            )
  
  )

   (define (mysteryDeepens f id lis)
            (if (null? lis) id
                [f (car lis) (mysteryDeepens f id (cdr lis))]
            )
  
  )

What are the values of (mystery '(a b c d)), (mystery '(a b 1 2 c d)) and (mysteryDeepens + 200 '(1 2 3 4))?

Explain clearly the list functions computed by the above Scheme definitions. (Your explanation should be sufficiently precise. That is, write two questions for which these two definitions are the answers (a la Jeopardy).)

2.  Java Concepts (6 + 5 + 5 pts)

3.  Recursive Definition (4 + (1 + 2 + 4) pts)

Study the Java program given on the reverse side carefully and answer the following questions.

        x
        x - y
        x - y - y


T. K. Prasad