Deck 3: Functional Programming

Full screen (f)
exit full mode
Question
In Scheme,a let special form can be used to define a recursive function.
Use Space or
up arrow
down arrow
to flip the card.
Question
Scheme expressions must be written in prefix form.
Question
The semantics of Scheme uses static type checking.
Question
Scheme expressions that begin with keywords are called control forms.
Question
The ML programming language is strongly typed.
Question
The simplest unit of syntax in Scheme is called an atom.
Question
A function that takes other functions as parameters or returns a function as a value is called a recursive function.
Question
A function definition describes how a value is to be computed using formal parameters.
Question
A pure functional program is one that consists only of functions and procedures.
Question
In the ML programming language,a function is declared using the lambda keyword.
Question
hd is the predefined list function that returns the head of a list in Scheme.
Question
With static scoping,the meaning of a variable depends on the runtime context.
Question
The rand function is referentially transparent.
Question
The if form in Scheme is like an if-else construct.
Question
A function application is a call to a defined function using actual parameters.
Question
The ML programming language has a built-in list reverse function called rev.
Question
A language is considered to be fully curried if function definitions are treated as curried and if all multiparameter built-in functions are curried.
Question
A Scheme compiler will translate a tail recursive function into code that executes as a loop.
Question
In Scheme,the letrec form makes a global binding of a variable visible in the top-level environment.
Question
In ML,arithmetic operators are written as infix operators.
Question
Which of the following represents a list in ML?

A) (1 2 3)
B) {1 2 3}
C) [1, 2, 3]
D) (1, 2, 3)
Question
Which of the following Scheme statements will insert the number 6 at the head of a list named L?

A) (add 6 L)
B) (insert 6 L)
C) (hd 6 L)
D) (cons 6 L)
Question
To express symbols as a data type in Scheme,use the keyword ____.

A) symbol
B) form
C) quote
D) exclamation
Question
What is the purpose of a binding list in Scheme?

A) It creates a function.
B) It marks an expression for delayed evaluation.
C) It binds variable names to values.
D) It specifies a list of parameters for a function.
Question
Which of the following correctly assigns values to two variables and then multiplies them in the Scheme programming language?

A) (let ((x 5) (y 3)) (* x y))
B) (let (x 5) (y 3)) (* x y)
C) let (x 5) (y 3) (* x y)
D) (let (x 5 y 3) (* x y))
Question
Which of the following statements about functional programming languages is incorrect?

A) In pure functional programming, there are no assignments.
B) In pure functional programming, there are no loops.
C) In pure functional programming, loops are replaced by recursive calls.
D) The value of a function depends on the order of evaluation of its parameters.
Question
Which of the following represents a list of data in Scheme?

A) (3.1, 3.2, 3.3)
B) (3.1; 3.2; 3.3)
C) (quote (3.1 3.2 3.3))
D) (quote (3.1, 3.2, 3.3))
Question
To define a value in the ML programming language,use the ____ keyword.

A) define
B) let
C) letrec
D) val
Question
To determine if two lists have the same fringe,we must flatten them to just lists of their atoms.
Question
Which of the following statements about Scheme is correct?

A) Scheme function applications use pass by value, while special forms in Scheme use delayed evaluation.
B) Scheme function applications use pass by name, while special forms in Scheme use delayed evaluation.
C) Scheme special forms use pass by value, while function applications in Scheme use delayed evaluation.
D) Scheme special forms use pass by value, while function applications in Scheme use delayed evaluation.
Question
The Haskell language requires semicolons and bracketing to resolve ambiguities.
Question
Given a list L in Scheme with contents of (3 7 2 8).What will be returned if the command (cdr L)is executed?

A) (8)
B) (3)
C) (2 8)
D) (7 2 8)
Question
The essential construct of lambda calculus is called the lambda application.
Question
The definition of a language using an interpreter written in the same language is called a ____.

A) metaphysical interpreter
B) metaphysical interpreter
C) metaphorical interpreter
D) metacircular interpreter
Question
Given a list L in Scheme with contents of ((x y)s (t)).What will be returned if the command (cdr (car L))is executed?

A) (x)
B) (y)
C) (x y)
D) (t)
Question
Haskell supports a type class inheritance through a hierarchy of type classes.
Question
Lists that obey lazy evaluation are called serialized lists.
Question
The Scheme evaluation rule represents ____ evaluation.

A) applicative order
B) normal order
C) binary order
D) sequential order
Question
Which of the following statements about scoping in Scheme is correct?

A) A bound variable is a variable referenced within a function that is not also a formal parameter to that function.
B) A free variable is a variable within a function that is also a formal parameter to that function.
C) A free variable is a variable referenced within a function that is not also a formal parameter to that function.
D) A free variable is one that is bound within a nested function.
Question
The ____ is used in Scheme to create a function.

A) let special form
B) letrec special form
C) lambda special form
D) procedure special form
Question
In lambda calculus,a conversion that allows for the elimination of redundant lambda abstractions is call ____.

A) eta-conversion
B) alpha-conversion
C) beta-conversion
D) beta-abstraction
Question
In lambda calculus,a value can be substituted for a variable by use of a(n)____.

A) reduction rule
B) evaluation rule
C) abstraction rule
D) application rule
Question
If the ML command val h::t = [4 5 6]; is executed,what value will t have?

A) [1]
B) [2]
C) [1 2]
D) [2 3]
Question
The ____ character in ML indicates a wildcard.

A) hyphen
B) asterisk
C) question mark
D) underscore
Question
Standard predefined resources for performing input and output in ML are contained in a ____.

A) package
B) library
C) class
D) structure
Question
Which of the following statements is correct?

A) A language with nonstrict functions is easier to implement.
B) A function that will produce well-defined results, even when subexpressions or parameters may be undefined, is said to be strict.
C) Delayed execution can lead to well-defined results, even when subexpressions or parameters may be undefined.
D) Nonstrictness is always an undesirable property in a language.
Question
Which of the following statements about lazy evaluation is incorrect?

A) Operations on lists must evaluate the entire list.
B) All arguments to user-defined functions are delayed.
C) All arguments to constructor functions are delayed.
D) All bindings of local names in let and letrec expressions are delayed.
Question
Which of the following statements about Haskell is correct?

A) Haskell is a lazy language that is not fully curried.
B) Haskell is a fully curried language that does not do delayed evaluation.
C) Haskell is a fully curried and lazy language.
D) Haskell does not support higher-order functions.
Question
In the Haskell language,the ____ character represents the lambda.

A) backslash
B) underscore
C) vertical bar
D) ampersand
Question
The ____ character is used for alternative values in the ML programming language.

A) underscore
B) vertical bar
C) ampersand
D) percent sign
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Functional Programming
1
In Scheme,a let special form can be used to define a recursive function.
False
2
Scheme expressions must be written in prefix form.
True
3
The semantics of Scheme uses static type checking.
False
4
Scheme expressions that begin with keywords are called control forms.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
The ML programming language is strongly typed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
The simplest unit of syntax in Scheme is called an atom.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
A function that takes other functions as parameters or returns a function as a value is called a recursive function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
A function definition describes how a value is to be computed using formal parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
A pure functional program is one that consists only of functions and procedures.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
In the ML programming language,a function is declared using the lambda keyword.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
hd is the predefined list function that returns the head of a list in Scheme.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
With static scoping,the meaning of a variable depends on the runtime context.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The rand function is referentially transparent.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The if form in Scheme is like an if-else construct.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A function application is a call to a defined function using actual parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
The ML programming language has a built-in list reverse function called rev.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
A language is considered to be fully curried if function definitions are treated as curried and if all multiparameter built-in functions are curried.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
A Scheme compiler will translate a tail recursive function into code that executes as a loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
In Scheme,the letrec form makes a global binding of a variable visible in the top-level environment.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
In ML,arithmetic operators are written as infix operators.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Which of the following represents a list in ML?

A) (1 2 3)
B) {1 2 3}
C) [1, 2, 3]
D) (1, 2, 3)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following Scheme statements will insert the number 6 at the head of a list named L?

A) (add 6 L)
B) (insert 6 L)
C) (hd 6 L)
D) (cons 6 L)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
To express symbols as a data type in Scheme,use the keyword ____.

A) symbol
B) form
C) quote
D) exclamation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
What is the purpose of a binding list in Scheme?

A) It creates a function.
B) It marks an expression for delayed evaluation.
C) It binds variable names to values.
D) It specifies a list of parameters for a function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following correctly assigns values to two variables and then multiplies them in the Scheme programming language?

A) (let ((x 5) (y 3)) (* x y))
B) (let (x 5) (y 3)) (* x y)
C) let (x 5) (y 3) (* x y)
D) (let (x 5 y 3) (* x y))
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
Which of the following statements about functional programming languages is incorrect?

A) In pure functional programming, there are no assignments.
B) In pure functional programming, there are no loops.
C) In pure functional programming, loops are replaced by recursive calls.
D) The value of a function depends on the order of evaluation of its parameters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following represents a list of data in Scheme?

A) (3.1, 3.2, 3.3)
B) (3.1; 3.2; 3.3)
C) (quote (3.1 3.2 3.3))
D) (quote (3.1, 3.2, 3.3))
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
To define a value in the ML programming language,use the ____ keyword.

A) define
B) let
C) letrec
D) val
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
To determine if two lists have the same fringe,we must flatten them to just lists of their atoms.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following statements about Scheme is correct?

A) Scheme function applications use pass by value, while special forms in Scheme use delayed evaluation.
B) Scheme function applications use pass by name, while special forms in Scheme use delayed evaluation.
C) Scheme special forms use pass by value, while function applications in Scheme use delayed evaluation.
D) Scheme special forms use pass by value, while function applications in Scheme use delayed evaluation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The Haskell language requires semicolons and bracketing to resolve ambiguities.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Given a list L in Scheme with contents of (3 7 2 8).What will be returned if the command (cdr L)is executed?

A) (8)
B) (3)
C) (2 8)
D) (7 2 8)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
The essential construct of lambda calculus is called the lambda application.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The definition of a language using an interpreter written in the same language is called a ____.

A) metaphysical interpreter
B) metaphysical interpreter
C) metaphorical interpreter
D) metacircular interpreter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
Given a list L in Scheme with contents of ((x y)s (t)).What will be returned if the command (cdr (car L))is executed?

A) (x)
B) (y)
C) (x y)
D) (t)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Haskell supports a type class inheritance through a hierarchy of type classes.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Lists that obey lazy evaluation are called serialized lists.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
The Scheme evaluation rule represents ____ evaluation.

A) applicative order
B) normal order
C) binary order
D) sequential order
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements about scoping in Scheme is correct?

A) A bound variable is a variable referenced within a function that is not also a formal parameter to that function.
B) A free variable is a variable within a function that is also a formal parameter to that function.
C) A free variable is a variable referenced within a function that is not also a formal parameter to that function.
D) A free variable is one that is bound within a nested function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ is used in Scheme to create a function.

A) let special form
B) letrec special form
C) lambda special form
D) procedure special form
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
In lambda calculus,a conversion that allows for the elimination of redundant lambda abstractions is call ____.

A) eta-conversion
B) alpha-conversion
C) beta-conversion
D) beta-abstraction
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
In lambda calculus,a value can be substituted for a variable by use of a(n)____.

A) reduction rule
B) evaluation rule
C) abstraction rule
D) application rule
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
If the ML command val h::t = [4 5 6]; is executed,what value will t have?

A) [1]
B) [2]
C) [1 2]
D) [2 3]
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
The ____ character in ML indicates a wildcard.

A) hyphen
B) asterisk
C) question mark
D) underscore
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
Standard predefined resources for performing input and output in ML are contained in a ____.

A) package
B) library
C) class
D) structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
Which of the following statements is correct?

A) A language with nonstrict functions is easier to implement.
B) A function that will produce well-defined results, even when subexpressions or parameters may be undefined, is said to be strict.
C) Delayed execution can lead to well-defined results, even when subexpressions or parameters may be undefined.
D) Nonstrictness is always an undesirable property in a language.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Which of the following statements about lazy evaluation is incorrect?

A) Operations on lists must evaluate the entire list.
B) All arguments to user-defined functions are delayed.
C) All arguments to constructor functions are delayed.
D) All bindings of local names in let and letrec expressions are delayed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
Which of the following statements about Haskell is correct?

A) Haskell is a lazy language that is not fully curried.
B) Haskell is a fully curried language that does not do delayed evaluation.
C) Haskell is a fully curried and lazy language.
D) Haskell does not support higher-order functions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
In the Haskell language,the ____ character represents the lambda.

A) backslash
B) underscore
C) vertical bar
D) ampersand
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The ____ character is used for alternative values in the ML programming language.

A) underscore
B) vertical bar
C) ampersand
D) percent sign
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.