Deck 6: Design With Functions

ملء الشاشة (f)
exit full mode
سؤال
Recursive functions are frequently used to design algorithms for computing values that have a recursive definition.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The assignment of roles and responsibilities to different actors in a program is also called responsibility-driven design.
سؤال
When you design an algorithm, it should be general enough to provide a solution to many problem instances, not just one or a few of them.
سؤال
The use of a common pool of data allows a program to grow easily as new data sources are added to the program.
سؤال
Like with an infinite loop, an infinite recursion eventually halts execution with an error message.
سؤال
Each box in a structure chart is labeled with a module name.
سؤال
Recursive functions tend to be more complicated than the corresponding loops.
سؤال
The amount of memory needed for a loop grows with the size of the problem's data set.
سؤال
When a call returns or completes its execution, the memory for the stack frame is reallocated.
سؤال
A function call expresses the idea of a process to the programmer, forcing him or her to wade through the complex code that realizes that idea.
سؤال
The first five numbers of the Fibonacci sequence are 1 3 5 8 13.
سؤال
In a case of infinite recursion, the Python virtual machine eventually runs out of memory resources to manage the process, so it halts execution with an error message.
سؤال
An abstraction hides detail and thus allows a person to view many things as just one thing.
سؤال
To get a better understanding of how recursion works, it is helpful to trace its calls.
سؤال
A recursive function must contain at least one repetition statement.
سؤال
Most recursive functions expect no arguments.
سؤال
In bottom-up design, you decompose a complex problem into a set of simpler problems and solve these with different functions.
سؤال
It is possible to construct any algorithm using only Python's built-in operators and control statements.
سؤال
Recursive solutions are often more natural and elegant than their iterative counterparts.
سؤال
A black-box chart is a diagram that shows the relationships among a program's functions and the passage of data between them.
سؤال
How does top-down design work?

A) A problem is solved by employing a large task force to evaluate the cause.
B) A problem is solved by redesigning and repurposing existing software.
C) A solution is created to solve a problem, and individual issues are resolved as they are encountered.
D) A problem is decomposed into smaller problems, which are gradually solved to produce a solution.
سؤال
In a recursive function, what is used to determine whether to stop or to continue with another recursive step?

A) terminator value
B) base case
C) recursion factor
D) step counter
سؤال
Where can the required arguments for a function be found?

A) In the function header.
B) In the module docstring.
C) In the function keyword list.
D) In the function's return list.
سؤال
What is the name for a diagram that shows the relationships among a program's functions and the passage of data between them?

A) data map
B) structure map
C) structure chart
D) program flowchart
سؤال
For each call of a function, the Python virtual machine must allocate a small chunk of memory on the call stack, which is known by what term?

A) stack chunk
B) stack frame
C) data nibble
D) memory slice
سؤال
A Python function cannot under normal circumstances reference a module variable for its value.
سؤال
The process of hiding a complex process by developing a mechanism to simplify or hide that process is known by what term?

A) simplification
B) obfuscation
C) abstraction
D) diffraction
سؤال
What is the purpose of a higher-order function?

A) It separates the task of transforming data values from the logic of accumulating the results.
B) It is a mutator that can be utilized on functions to remove redundant patterns in code.
C) It allows the definition of specialized ordering logic for data sets.
D) It is a special function that ignores program scope and has access to localized variables.
سؤال
In Python, functions are treated as first-class data objects. What does this mean?

A) It means that they are considered to be global variables inside any Python code.
B) It means that the functions are given higher priority over resource access than regular chunks of code.
C) It means that functions are protected objects and are not easily imported from other modules, unless the author desires it.
D) It means that functions can be assigned to variables, passed as arguments to other functions, returned as values, and stored in data structures.
سؤال
The assignment of roles and responsibilities to different actors in a program is known as what type of design?

A) role-based access design
B) responsibility-driven design
C) delegated assignment design
D) task abstraction design
سؤال
What is the call stack used for in the Python virtual machine?

A) The call stack is an area of reserved memory used to store chunks of memory related to functions.
B) The call stack is an area of reserved memory used to perform system calls for access to hardware.
C) The call stack is a log of called functions and methods within the program.
D) The call stack is a temporary storage area for junk data.
سؤال
Smart compilers exist that can optimize some recursive functions by translating them to iterative machine code.
سؤال
What type of error is raised when the Python virtual machine runs out of memory resources to manage a process?

A) runaway process error
B) out of memory error
C) input output error
D) stack overflow error
سؤال
The Fibonacci sequence is a series of values that can be easily calculated with what kind of function?

A) recursive function
B) repeating function
C) duplicating function
D) compounding function
سؤال
A method reference always uses an object, which can be denoted by a string followed by a dot and the method name.
سؤال
What happens when a function tries to assign or change a value of a variable that has been defined at the module level?

A) The function succeeds, because the module variable is considered global in scope.
B) The function succeeds, but the value is appended to the variable.
C) The function fails, and an out of scope error message is raised.
D) Python creates a temporary variable with the same name, and the value of that variable exists only within the scope of the function.
سؤال
A program's namespace is the set of its variables and their values.
سؤال
What are two common methods by which functions serve as abstraction mechanisms? (Choose two.)

A) The elimination of redundant, or repetitious code.
B) The availability of detailed docstring data.
C) The hiding of complicated processes.
D) The use of a bottom-up approach to design.
سؤال
When using functions that have default arguments, the required arguments must be provided and must be placed in the same positions as they are in the function definition's header.
سؤال
What can often provide you with a pattern for designing the structure of a program?

A) The structure of the problem you're attempting to solve.
B) The structure of code written by other people.
C) The structure of an organization's workforce.
D) The structure of the programming language used.
سؤال
The gradual process of developing functions to solve each subproblem in a top-down design is known as what process?

A) procedural refinement
B) stepwise refinement
C) progressing resolution
D) incremental solving
سؤال
What makes up a Python program's namespace?

A) The combination of all included modules and their functions.
B) The set of all its variables and their values.
C) The defined methods of the program.
D) The main method of the program itself.
سؤال
In what higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to an object?

A) mapping
B) filtering
C) reducing
D) associating
سؤال
What higher-order function process applies a function to each value in a sequence and returns a new sequence of the results?

A) mapping
B) filtering
C) reducing
D) associating
سؤال
In Python, what is the term that is used to describe the area of a program text in which an object name refers to a given value?

A) relation
B) relevance
C) lifetime
D) scope
سؤال
What are the two different ways that default arguments can be provided to a function? (Choose two.)

A) By supplying arguments in which they occur in the function header.
B) By using a reference pointer variable.
C) By overloading the function and redefining the arguments.
D) By assigning values to the keys in the function header.
سؤال
What term describes a dictionary of functions keyed by command names?

A) command table
B) jump table
C) skip table
D) function table
سؤال
Which of the following statements are accurate? (Choose two.)

A) Parameters for a function receive values when they are declared.
B) When module variables are introduced in a program, they are immediately given a value.
C) A nested variable can assign value to a variable outside of its scope.
D) Temporary values receive their values as soon as they are introduced.
سؤال
What is the lambda function in Python utilized for?

A) It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.
B) It creates an overloaded function, such that the function can be repurposed on the fly.
C) It allows for the tracking of use of a targeted function.
D) It allows for multiple higher-order functions to be utilized on the same selection statements.
سؤال
What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?

A) mapping
B) filtering
C) reducing
D) associating
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 6: Design With Functions
1
Recursive functions are frequently used to design algorithms for computing values that have a recursive definition.
True
2
The assignment of roles and responsibilities to different actors in a program is also called responsibility-driven design.
True
3
When you design an algorithm, it should be general enough to provide a solution to many problem instances, not just one or a few of them.
True
4
The use of a common pool of data allows a program to grow easily as new data sources are added to the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Like with an infinite loop, an infinite recursion eventually halts execution with an error message.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
Each box in a structure chart is labeled with a module name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Recursive functions tend to be more complicated than the corresponding loops.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
The amount of memory needed for a loop grows with the size of the problem's data set.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
When a call returns or completes its execution, the memory for the stack frame is reallocated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
A function call expresses the idea of a process to the programmer, forcing him or her to wade through the complex code that realizes that idea.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
The first five numbers of the Fibonacci sequence are 1 3 5 8 13.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
In a case of infinite recursion, the Python virtual machine eventually runs out of memory resources to manage the process, so it halts execution with an error message.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
An abstraction hides detail and thus allows a person to view many things as just one thing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
To get a better understanding of how recursion works, it is helpful to trace its calls.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
A recursive function must contain at least one repetition statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
Most recursive functions expect no arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
In bottom-up design, you decompose a complex problem into a set of simpler problems and solve these with different functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
It is possible to construct any algorithm using only Python's built-in operators and control statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
Recursive solutions are often more natural and elegant than their iterative counterparts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
A black-box chart is a diagram that shows the relationships among a program's functions and the passage of data between them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
How does top-down design work?

A) A problem is solved by employing a large task force to evaluate the cause.
B) A problem is solved by redesigning and repurposing existing software.
C) A solution is created to solve a problem, and individual issues are resolved as they are encountered.
D) A problem is decomposed into smaller problems, which are gradually solved to produce a solution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
In a recursive function, what is used to determine whether to stop or to continue with another recursive step?

A) terminator value
B) base case
C) recursion factor
D) step counter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Where can the required arguments for a function be found?

A) In the function header.
B) In the module docstring.
C) In the function keyword list.
D) In the function's return list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
What is the name for a diagram that shows the relationships among a program's functions and the passage of data between them?

A) data map
B) structure map
C) structure chart
D) program flowchart
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
For each call of a function, the Python virtual machine must allocate a small chunk of memory on the call stack, which is known by what term?

A) stack chunk
B) stack frame
C) data nibble
D) memory slice
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
A Python function cannot under normal circumstances reference a module variable for its value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
The process of hiding a complex process by developing a mechanism to simplify or hide that process is known by what term?

A) simplification
B) obfuscation
C) abstraction
D) diffraction
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
What is the purpose of a higher-order function?

A) It separates the task of transforming data values from the logic of accumulating the results.
B) It is a mutator that can be utilized on functions to remove redundant patterns in code.
C) It allows the definition of specialized ordering logic for data sets.
D) It is a special function that ignores program scope and has access to localized variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
In Python, functions are treated as first-class data objects. What does this mean?

A) It means that they are considered to be global variables inside any Python code.
B) It means that the functions are given higher priority over resource access than regular chunks of code.
C) It means that functions are protected objects and are not easily imported from other modules, unless the author desires it.
D) It means that functions can be assigned to variables, passed as arguments to other functions, returned as values, and stored in data structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The assignment of roles and responsibilities to different actors in a program is known as what type of design?

A) role-based access design
B) responsibility-driven design
C) delegated assignment design
D) task abstraction design
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
What is the call stack used for in the Python virtual machine?

A) The call stack is an area of reserved memory used to store chunks of memory related to functions.
B) The call stack is an area of reserved memory used to perform system calls for access to hardware.
C) The call stack is a log of called functions and methods within the program.
D) The call stack is a temporary storage area for junk data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
Smart compilers exist that can optimize some recursive functions by translating them to iterative machine code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
What type of error is raised when the Python virtual machine runs out of memory resources to manage a process?

A) runaway process error
B) out of memory error
C) input output error
D) stack overflow error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
The Fibonacci sequence is a series of values that can be easily calculated with what kind of function?

A) recursive function
B) repeating function
C) duplicating function
D) compounding function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
A method reference always uses an object, which can be denoted by a string followed by a dot and the method name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
What happens when a function tries to assign or change a value of a variable that has been defined at the module level?

A) The function succeeds, because the module variable is considered global in scope.
B) The function succeeds, but the value is appended to the variable.
C) The function fails, and an out of scope error message is raised.
D) Python creates a temporary variable with the same name, and the value of that variable exists only within the scope of the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
A program's namespace is the set of its variables and their values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
What are two common methods by which functions serve as abstraction mechanisms? (Choose two.)

A) The elimination of redundant, or repetitious code.
B) The availability of detailed docstring data.
C) The hiding of complicated processes.
D) The use of a bottom-up approach to design.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
When using functions that have default arguments, the required arguments must be provided and must be placed in the same positions as they are in the function definition's header.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
What can often provide you with a pattern for designing the structure of a program?

A) The structure of the problem you're attempting to solve.
B) The structure of code written by other people.
C) The structure of an organization's workforce.
D) The structure of the programming language used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
The gradual process of developing functions to solve each subproblem in a top-down design is known as what process?

A) procedural refinement
B) stepwise refinement
C) progressing resolution
D) incremental solving
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
What makes up a Python program's namespace?

A) The combination of all included modules and their functions.
B) The set of all its variables and their values.
C) The defined methods of the program.
D) The main method of the program itself.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
In what higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to an object?

A) mapping
B) filtering
C) reducing
D) associating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
What higher-order function process applies a function to each value in a sequence and returns a new sequence of the results?

A) mapping
B) filtering
C) reducing
D) associating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
In Python, what is the term that is used to describe the area of a program text in which an object name refers to a given value?

A) relation
B) relevance
C) lifetime
D) scope
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
What are the two different ways that default arguments can be provided to a function? (Choose two.)

A) By supplying arguments in which they occur in the function header.
B) By using a reference pointer variable.
C) By overloading the function and redefining the arguments.
D) By assigning values to the keys in the function header.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
What term describes a dictionary of functions keyed by command names?

A) command table
B) jump table
C) skip table
D) function table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which of the following statements are accurate? (Choose two.)

A) Parameters for a function receive values when they are declared.
B) When module variables are introduced in a program, they are immediately given a value.
C) A nested variable can assign value to a variable outside of its scope.
D) Temporary values receive their values as soon as they are introduced.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
What is the lambda function in Python utilized for?

A) It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.
B) It creates an overloaded function, such that the function can be repurposed on the fly.
C) It allows for the tracking of use of a targeted function.
D) It allows for multiple higher-order functions to be utilized on the same selection statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?

A) mapping
B) filtering
C) reducing
D) associating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.