Quiz 4 Flashcards

1
Q

(λ x . + 3 x) 4
What is the value of the lambda expression above?

7, 4, 3, or 1?

A

7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ML allows function overloading, T/F?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ML is statically typed, so that the type of every expression is determined before execution, and types can be checked for consistency, T/F?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following is not a feature of Haskell?

Lazy Evaluation, Dynamic Typing, Pattern Matching, or Immutability?

A

Dynamic Typing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

val h :: t = [4,2,1,3];
For the given assignment in ML above, what is the value of t?

[2,1,3], 4, 3, or [4,2,1,3]?

A

[2,1,3]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following programming languages has lazy evaluation by default?

ML, Haskell, Scheme, or Lisp?

A

Haskell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

__________ is a rule in lambda calculus that allows you to change the name of the bound variable in a lambda expression without changing the expression’s meaning. It’s essentially renaming the formal parameters to avoid name clashes or improve clarity.

Beta-abstraction, Eta-conversion, Alpha-conversion, or Beta-reduction?

A

Alpha-conversion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

__________ is the process of applying a function to its argument in lambda calculus. E.g., ((λx. + x 1) 2) => (+ 2 1)

Eta-conversion, Alpha-conversion, Beta-abstraction, or Beta-reduction?

A

Beta-reduction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Scheme does not allow delayed evaluation, T/F?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

fun pow (x,0) = 1 | pow (x,y) = x * pow (x, y-1);
For the given power function in ML above, which of the following is the correct syntax to calculate 35?

pow(3,5), (pow) 3 5, (pow 3 5), or (3,5) pow

A

pow(3,5)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly