exam 1 of Scripting questions with complete solutions
_____ is the process where objects that are no longer needed are
deleted.
a. Identity recycling
b. Memory clearing
c. Garbage collection
d. Object recycling Correct Answer c. Garbage collection
________ can be set to specify optional directories where
modules are located.
a. sys.path
b. python.path
c. SYSPATH
d. PYTHONPATH Correct Answer d. PYTHONPATH
__________ allows a function or operator to perform different
tasks depending on the types of the arguments or operands.
a. Polymorphism
b. Static typing
c. Type declaration
d. Prototyping Correct Answer a. Polymorphism
__________ are classes that provide additional behavior to
methods and are not themselves meant to be instantiated.
a. Derived classes
,b. Mixin classes
c. Base classes
d. Inheritance classes Correct Answer b. Mixin classes
0s and 1s are known as ___ .
a. switches
b. bits
c. voltage
d. electricity Correct Answer b. bits
15 _____ 3 = 0
a. %
b. /
c. //
d. * Correct Answer a. %
15 _____ 3 = 5.0
a. %
b. ^
c. /
d. // Correct Answer c. /
41) Which of the following identifiers is valid?
a. max_age
b. 32area
c. transfer$
d. True Correct Answer a. max_age
,62) What is the value of the __name__ built-in variable in a
module that is executed as a script by the programmer?
a. __main__
b. __direct__
c. __module__
d. __executed__ Correct Answer a. __main__
A _____ can be located in a dictionary and is associated with a
value.
a. value
b. pair
c. list
d. key Correct Answer d. key
A _____ is a computer component that stores files and other
data.
a. disk
b. monitor
c. keyboard
d. processor Correct Answer a. disk
A _____ is a named item used to hold a value.
a. constant
b. number
c. statement
d. variable Correct Answer d. variable
, A _____ is a word that is part of the Python language and can't
be used as a variable name.
a. keyword
b. special token
c. syntax symbol
d. stylized word Correct Answer a. keyword
A __________ is a namespace that contains definitions from the
module.
a. module function
b. module class
c. module script
d. module object Correct Answer d. module object
A base case is a _____.
a. case that returns a value without performing a recursive call
b. function method that calls itself
c. function execution instance that calls another execution
instance of the same function.
d. case that calls another function method Correct Answer a.
case that returns a value without performing a recursive call
A child is required to use a booster seat in a car until the child is
9 years old, unless the child reaches the height of 59 inches
before age 9. Which expression can be used to decide if a child
requires a car seat or not?