Deck 7: Modular Design
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/62
العب
ملء الشاشة (f)
Deck 7: Modular Design
1
Modular design allows programs to be broken down into manageable size parts, in which each module (part) is a function with clearly specified functionality.
False
2
A module may be just the design of specific functionality, without any implementation.
True
3
A module, in terms of program design, may consist of a single function.
True
4
Modules are useful for the design, development, testing and maintenance of computer programs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
5
The specification of a module is referred to as the module's interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
6
A client should always be knowledgeable of the implementation of a module using, and not rely soley on the module's specification (interface).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
7
A docstring is a specific feature of Python for providing the specification of program elements (e.g., functions and modules).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
8
The __doc__ extension in Python is used in the creation of docstrings.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
9
Broadly speaking, a module is
A) a design of specific functionality to be incorporated into a program
B) the implementation of specific functionality to be incorporated into a program
C) a design and/or implementation of specific functionality to be incorporated into a program
D) a function
E) a collection of functions
A) a design of specific functionality to be incorporated into a program
B) the implementation of specific functionality to be incorporated into a program
C) a design and/or implementation of specific functionality to be incorporated into a program
D) a function
E) a collection of functions
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the following do software modules not facilitate?
A) software design
B) software development
C) software execution speed
D) software testing
E) software modification and maintenance
A) software design
B) software development
C) software execution speed
D) software testing
E) software modification and maintenance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
11
The interface of a module is
A) an initial set of Python instructions of the module called once by any client
B) specification of the module providing information to any client
C) a common set of Python instructions in both the module and any of lts clients
D) a common specification in both the module and any client of its clients
E) a common set of values shared by both a module and its clients
A) an initial set of Python instructions of the module called once by any client
B) specification of the module providing information to any client
C) a common set of Python instructions in both the module and any of lts clients
D) a common specification in both the module and any client of its clients
E) a common set of values shared by both a module and its clients
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
12
A docstring is,
A) any Python string used to provide the specification of a program element (e.g., module)
B) any Python string delimited by double quotes providing the specification of a program element.
C) any Python string delimited by triple quotes providing the specification of a program element.
D) any Python string delimited by triple quotes given as the first line of a program element.
E) any triple quoted string in Python
A) any Python string used to provide the specification of a program element (e.g., module)
B) any Python string delimited by double quotes providing the specification of a program element.
C) any Python string delimited by triple quotes providing the specification of a program element.
D) any Python string delimited by triple quotes given as the first line of a program element.
E) any triple quoted string in Python
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
13
The __doc__ extension in Python is used to
A) display the docstring of a program element
B) display all the docstrings in a given program
C) reassign the docstring of a program element
D) toggle the docstring of a program element on and off
E) returns True or False for determing if a given program element has a provided docstring
A) display the docstring of a program element
B) display all the docstrings in a given program
C) reassign the docstring of a program element
D) toggle the docstring of a program element on and off
E) returns True or False for determing if a given program element has a provided docstring
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
14
Match the following:
-imports a module
A) module
B) interface
C) client
D) docstring
E) __doc__
-imports a module
A) module
B) interface
C) client
D) docstring
E) __doc__
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
15
Match the following:
-displays specification
A) module
B) interface
C) client
D) docstring
E) __doc__
-displays specification
A) module
B) interface
C) client
D) docstring
E) __doc__
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
16
Match the following:
-Python string
A) module
B) interface
C) client
D) docstring
E) __doc__
-Python string
A) module
B) interface
C) client
D) docstring
E) __doc__
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
17
Match the following:
-design or implementation
A) module
B) interface
C) client
D) docstring
E) __doc__
-design or implementation
A) module
B) interface
C) client
D) docstring
E) __doc__
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
18
Match the following:
-specification
A) module
B) interface
C) client
D) docstring
E) __doc__
-specification
A) module
B) interface
C) client
D) docstring
E) __doc__
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
19
A ___________________ consists of the design and/or implementation of specific functionality.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
20
The term ____________________ refers to the specification provided for use of a given module. In Python, a _________________ is used to provided such specification.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
21
Any program code that makes use of a given module is called a ____________ of the module.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
22
For the following function,
def elapsed_time(start_hr, start_mins, end_hr, end_mins)
-Give an appropriate docstring specification, where function elapsed_time returns the total number of minutes between the provided start and end times.
def elapsed_time(start_hr, start_mins, end_hr, end_mins)
-Give an appropriate docstring specification, where function elapsed_time returns the total number of minutes between the provided start and end times.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
23
For the following function,
def elapsed_time(start_hr, start_mins, end_hr, end_mins)
-GIve a print statement that displays the docstring for this function.
def elapsed_time(start_hr, start_mins, end_hr, end_mins)
-GIve a print statement that displays the docstring for this function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
24
In top-down design, the overall design of a program is developed before the more detailed aspects of the design.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
25
In top-down design, evey module is broken down the same number of levels of submodules.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
26
Top-down design is an approach for developing a _______________ design.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
27
The three top-level modules for the calendar year program in Chapter 7 of the textbook are
______________, ______________________, and ______________________.
______________, ______________________, and ______________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
28
Develop a modular design of the typical aspects of a house. Include things such rooms, systems (for example, the plumbing, electrical, and heating systems), and other aspects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
29
A module in Python is a file containing definitions and statements, which must contain a module declaration statement as the first line.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
30
Modules in Python have their own namespace.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
31
A name clash results when the same identifier is used in more than one function of a given program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
32
A fully qualified identifier is an identifier with the name of the module that it belongs to prepended to it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
33
The main module of a Python program is the one that is directly executed when a program is run.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
34
When using the import modulename form of import, the identifiers of the imported module become part of the namespace of the importing module.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
35
When a module is imported using the from modulename import identifier form of import, each imported identifier can be references without needing to be fully qualified.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
36
To avoid name clashes, and to make clear which module each imported identifier comes from, it is recommended that the import modulename form of import be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
37
Privates identifiers (variables) of a given module cannot be accessed by any importing module.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
38
When importing a module using the from modulename import * form of import, the private identifiers of the imported module are not imported, but can still be accessed by the importing module.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
39
Modules may have Python code outside of all function definitions that is executed when the module is first loaded.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
40
Built-in function dir() is used to create special directories (folders) for Python modules to be placed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following is not true of main modules?
A) main modules are directly executed.
B) main modules are given the name __main__.
C) main modules are meant to be imported into other modules.
D) main modules may import, or include, any number of other modules.
E) main modules provide the basis for a complete Python program.
A) main modules are directly executed.
B) main modules are given the name __main__.
C) main modules are meant to be imported into other modules.
D) main modules may import, or include, any number of other modules.
E) main modules provide the basis for a complete Python program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
42
The following line of code will
From math import factorial as simpFact
A) make every function from the math module available in a client program, but the function factorial will be renamed to simpFact.
B) import only the factorial function from the math module into client, which must be fully qualified when called.
C) import only the factorial function from the math module and integrate it into the namespace of the client as simpFact instead of factorial.
D) this is not proper Python code.
From math import factorial as simpFact
A) make every function from the math module available in a client program, but the function factorial will be renamed to simpFact.
B) import only the factorial function from the math module into client, which must be fully qualified when called.
C) import only the factorial function from the math module and integrate it into the namespace of the client as simpFact instead of factorial.
D) this is not proper Python code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
43
Assuming that the following function exists within a module to be imported into a client, how should the client treat this function?

A) the client can use this function at will as long as it imported.
B) this function is "private," even if a client imports its module, the function cannot be accessed.
C) this function is "private," the client can access it but should not.
D) the client should print this functions docstring before using it

A) the client can use this function at will as long as it imported.
B) this function is "private," even if a client imports its module, the function cannot be accessed.
C) this function is "private," the client can access it but should not.
D) the client should print this functions docstring before using it
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of these is not a type of namespace in Python?
A) foreign Namesapce
B) built-In Namespace
C) global Namespace
D) local Namespace
E) these are all valid namespaces
A) foreign Namesapce
B) built-In Namespace
C) global Namespace
D) local Namespace
E) these are all valid namespaces
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
45
The main module in Python is given the special name ______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
46
The modules of the Python Standard Library are referred to as the Standard ____________ modules.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
47
A _______________ is a container that provides a named context for a set of identifiers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
48
A _________________ is when two otherwise distinct entities with the same name become part of the same namespace.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
49
If an identifier is written such that it _________________________, then it is unique from all other identifiers in a given program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
50
If an identifier is written such that it is _________________________, then it is unique from all other identifiers in a given program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
51
To import a module name into the namespace of another module, the ____________________ form of import is used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
52
To import all of the identifiers of a given module so that they do not need to be fully qualified in the importin module, the _______________________ form of import is used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
53
In order to indicate that an identifier of a given module is to be considered private, the identifier begins and ends with ______________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
54
In Python, there are as many as three namespaces that can be active at a given time, these are the
_______________ namepace, the ______________ namepace, and the ______________ namespace.
_______________ namepace, the ______________ namepace, and the ______________ namespace.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
55
The fundamental operations for altering what is on a stack are ________ and _______.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
56
The operation for seeing what is on the top of stack without removing it is _________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
57
For the following module,
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Provide a main module that makes use of this module to prompt the user for the conversion desired, and displays the converted result, using the import modulename form of import.
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Provide a main module that makes use of this module to prompt the user for the conversion desired, and displays the converted result, using the import modulename form of import.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
58
For the following module,
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import identifier, identifier form of import.
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import identifier, identifier form of import.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
59
For the following module,
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import * form of import.
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import * form of import.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
60
For the following module,
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import identifier as new_identifier form of import.
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Modify (a) above using the from modulename import identifier as new_identifier form of import.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
61
For the following module,
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Describe the namespaces for the main modules of (a), (b), (c) and (d) above.
# module driving_conversions
def milesPerHr(km_speed):
'''Returns miles per hour for kilometers per hour given in speed. '''
def milesPerGal(KilometersPerLiter):
'''Returns miles per gallon for provided kilometers per liter. '''
-Describe the namespaces for the main modules of (a), (b), (c) and (d) above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
62
For the stack module given in the chapter, containing functions getStack(), isEmpty(s), top(s), push(s, item) and pop(s), give a main module that prompts the user for a list of numbers (one per line), and displays how many items there are of the last number input.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck