NEW
Font size
WorksheetsModule 09 - Day 3
Total questions: 10
Worksheet time: 5mins
What is the main concept of the mapping idiom?
It changes the data type of the list.
It applies a transformation to every list element.
It sorts the list in ascending order.
It removes duplicates from the list.
What is the purpose of introducing an auxiliary parameter in my-map?
To simplify the code
To abstract the desired transformation
To increase execution speed
To reduce memory usage
Which of the following patterns represents the map function: (map f (list x1 x2 ... xn)) ⇒
⇒ (list (f x1) (f x2) ... (f xn))
⇒ (list x1 x2 ... xn)
⇒ (f (list x1 x2 ... xn))
⇒ (list x1 x2 ... xn f)
What function captures the specialized pattern of mapping from natural numbers: 0, 1, 2 ... n-1?
map-list
build-list
create-list
generate-list
What is the purpose of asking the caller to provide a base value in the context of abstract folding?
To simplify the code
To ensure the function always returns a list
To handle unknown base values in any given context
To make the function faster
Which built-in function works just like my-fold?
map
filter
foldr
fold
What purpose does the auxiliary parameter combine serve in foldr?
The combine parameter indicates the maximum depth of the fold operation.
The combine parameter is used to specify the data type of the input list.
The combine parameter determines the base case for foldr.
The combine parameter specifies how to combine the list element with the recursive result.
Which of the following expressions is equivalent to (foldr cons empty (list 1 2 3))?
(list (list 1 2 3))
(list empty 1 2 3)
(list 1 2 3)
Error: cons cannot be used
Given the expression (foldr - 0 (list 1 2 3)), what is the result?
-4
-2
2
0
What is the result of the code?
(list 1 4 9 16 25 36)
(list 25 36 1 4 9 16)
(list 25 36 16 9 4 1)
(list (list 1 4 9 16) (list 25 36))
Error
