ENGR Final Exam | COMPLETE QUESTIONS
AND ANSWERS | 2025 LATEST UPDATED |
ALREADY GRADED A+
___________ development is the process of dividing a program into
separate modules that can be developed and tested separately
and then integrated into a single program. - . . ANSWER ✓✓
Modular
'Martin Luther King Jr.'.split()
will create the list of tokens ['Martin', 'Luther', 'King', 'Jr', '.']. - . .
ANSWER ✓✓ False
#TVUHS
data = [ 0, 0.0009977, 0.04, 5.03, 0.0001],
[20, 0.0009996, 83.61, 88.61, 0.2954],
...
[260, 0.0012755, 1128.5, 1134.9, 2.8841]]
You plan to use a for loop to iterate through data looking for the
two values h1 and h2 that bracket some value h provided by a
user. Assuming that the for loop is set up correctly and the
variable i is used as the loop iterator, fill in the blanks in the
,2|Page
expression that represents h1 <= h <= h2 in code and type in the
answer field(please do not use spaces inside brackets.)
data[i][_] <= h <= data[_][_] - . . ANSWER ✓✓ data[i][3] <= h <=
data[i+3][3]
A _________ is a string literal placed in the first line of a function
body. - . . ANSWER ✓✓ docstring
A comman separated values (csv) file is a simple text-based file
format that uses commas to separate data items. - . . ANSWER
✓✓ True
A function can be defined once, then called from multiple places
in a program. - . . ANSWER ✓✓ True
A function definition with no parameters should not have the
parentheses, as in:
def print_something:
print('something') - . . ANSWER ✓✓ False
A function may have multiple input parameters, which are
separated by commas. - . . ANSWER ✓✓ True
,3|Page
A function with no return statement, or a return statement with
no expression, like return, returns the value zero. - . . ANSWER
✓✓ False
A heriarchial tree structure will have a 'root' at the base. - . .
ANSWER ✓✓ True
A hierarchy helps you manage complexity. - . . ANSWER ✓✓
True
A key reason for creating functions is to help the program run
faster. - . . ANSWER ✓✓ False
A module is a file containing Python code that can be used by
other scripts, but not by other modules. - . . ANSWER ✓✓ False
A module is made available for use via the import statement. - . .
ANSWER ✓✓ True
A namespace maps names to objects. The Python interpreter
uses namespaces to track all of the objects in a program.
Fill in the blank: A namespace is actually just a normal Python
_____ whose keys are the names and whose values are the
objects. - . . ANSWER ✓✓ dictionary
, 4|Page
A package is a directory that, when imported, gives access to all
of the modules stored in the directory. - . . ANSWER ✓✓ True
A pass statement should be used in a function stub when the
programmer wants the stub to stop program execution when
called. - . . ANSWER ✓✓ False
A programmer can specify names to import from a module by
using the from keyword in an import statement: for example,
from math import cos, sin, sqrt - . . ANSWER ✓✓ True
A with statement can be used to open a file for reading only. - . .
ANSWER ✓✓ False
Add a return statement to the function that returns the cube of
the argument. Please do not include any unnecessary spaces
and/or parentheses. You cannot use a power function from the
math, numpy, sympy or similar modules.
def cubed(x):
______________________ - . . ANSWER ✓✓ return (x**3)