1 Top-down design is a strategy that a develops lower-level functions before the
ID: 3665763 • Letter: 1
Question
1 Top-down design is a strategy that
a develops lower-level functions before the functions that depend on
those lower-level functions
b starts with the main function and develops the functions on each
successive level beneath the main function
2 The relationships among functions in a top-down design are shown in a
a syntax diagram
b flow diagram
c structure chart
3 A recursive function
a usually runs faster than the equivalent loop
b usually runs more slowly than the equivalent loop
4 When a recursive function is called, the values of its arguments and its
return address are placed in a
a list
b dictionary
c set
d stack frame
5 The scope of a temporary variable is
a the statements in the body of the function where the variable is
introduced
b the entire module in which the variable is introduced
c the statements in the body of the function after the statement
where the variable is introduced
6 The lifetime of a parameter is
a the duration of program execution
b the duration of its function’s execution
7 The expression map(math.sqrt, [9, 25, 36]) evaluates to
a 70
b [81, 625, 1296]
c [3.0, 5.0, 6.0]
8 The expression filter(lambda x: x > 50, [34, 65, 10, 100])
evaluates to
a []
b [65, 100]
9 The expression reduce(max, [34, 21, 99, 67, 10]) evaluates to
a 231
b 0
c 99
10 A data structure used to implement a jump table is a
a list
b tuple
c dictionary
Explanation / Answer
1 Top-down design is a strategy that
Answer (b): starts with the main function and develops the functions on each
successive level beneath the main function
2 The relationships among functions in a top-down design are shown in a
Answer (c): structure chart
3 A recursive function
Answer (b): usually runs more slowly than the equivalent loop
4 When a recursive function is called, the values of its arguments and its
return address are placed in a
Answer (d) stack frame
5 The scope of a temporary variable is
Answer (c) : the statements in the body of the function after the statement
where the variable is introduced
6 The lifetime of a parameter is
Answer (b): the duration of its function’s execution
7 The expression map(math.sqrt, [9, 25, 36]) evaluates to
Answer (c) [3.0, 5.0, 6.0]
Hint: map() applies the function math.sqrt to all the elements of the sequence [9, 25, 36].
It returns a new list with the elements changed by math.sqrt
8 The expression filter(lambda x: x > 50, [34, 65, 10, 100])
evaluates to
Answer (b): [65, 100]
Hint: filter out all the elements of a [34, 65, 10, 100], for which the function x > 50 returns True.
9 The expression reduce(max, [34, 21, 99, 67, 10]) evaluates to
Answer (c) : 99
Hint : Continually applies the function max() to the sequence [34, 21, 99, 67, 10]. It returns a single value.
10 A data structure used to implement a jump table is a
Answer (c) dictionary
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.