Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS383 Programming Languages Quiz 2. 1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis.

Similar presentations


Presentation on theme: "CS383 Programming Languages Quiz 2. 1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis."— Presentation transcript:

1 CS383 Programming Languages Quiz 2

2 1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis. b.Make a proper inductive definition. c.Clearly state what you are doing induction on. d.Show one case for each rule in the inductive definition.

3 2. If the structure of your induction hypothesis is “If X and Y then A”, which of the following things is proper for you to assume and prove? a.Assume X or Y, prove A b.Assume X and Y, prove A c.Assume X prove A, or Assume Y prove A d.Assume X prove A, and Assume Y prove A

4 3. If the structure of your induction hypothesis is “If X or Y then A”, which of the following things is proper for you to assume and prove? a.Assume X or Y, prove A b.Assume X and Y, prove A c.Assume X prove A, or Assume Y prove A d.Assume X prove A, and Assume Y prove A

5 4. Which one of the following is not essential in lambda calculus? a.Variable: x b.Conditional: if e1 then e2 else e3 c.Abstraction: λ x. E d.Abstraction: λ x. e

6 5. Which one of the following is incorrect about the semantics of if- then-else? a. a b. c. d.

7 6. Which one of the following statements is incorrect? a.a name and the object it denote are not the same thing. b.an object can have only one name. c.a name can denote different objects at different times. d.binding is an association between a name and the object it represents.

8 7. Which one of the following is different from the other three after evaluation? a. λx. x x b. (λx. x x) (λy. y y) c. (λy. λx. y x) (λx. x x) (λy. y y) d. (λx. (λx. x x) x) (λx. x x)

9 8. What are the free variables in the following lambda expression? x (λy · y z x) (λm · λn · l m n) a.x, z, l b.x, y, z, l, m, n c.x, z, n d.y, l, m

10 9. For the following substitutions, which is incorrect? a. x[x/y] = y b. λ x · z w[x/y] = λy · z w c. (λx · (z x))[x/y] = (λu · (z u)) d. x z w[x/y] = y z w

11 10. What’s the result of the following lambda expression, under full beta- reduction? (λx · x)((λx · x)(λz · (λx · x)z)) a. λ z · z b. x c. z d. λ z · λz · z z


Download ppt "CS383 Programming Languages Quiz 2. 1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis."

Similar presentations


Ads by Google