CIT 486 FINAL ACTUAL EXAM NEWEST 2025/2026 WITH
COMPLETE QUESTIONS AND CORRECT ANSWERS |ALREADY
GRADED A+||BRAND NEW VERSION!
Which of the following statements is false.
You can import all identifiers defined in a module with a wildcard import of the
form
from modulename import *
A wildcard import makes all of the module's identifiers available for use in your
code.
The following session is an example of safe use of a wildcard import:
In [1]: e = 'hello'In [2]: from math import *In [3]: eOut[3]: 2.718281828459045
Importing a module's identifiers with a wildcard import can lead to subtle errors—
it's considered a dangerous practice that you should avoid. - ANSWER-The
following code calls function square twice. The first call produces the int value 49
and the second call produces the int value 0:
In [1]: def square(number):...: """Calculate the square of a number.""" ...: return
number ** 2 ...: In [2]: square(7)Out[2]: 49In [3]: square(.1)Out[3]: 0
The following code produces 10 random integers in the range 1-6 to simulate
rolling a six-sided die:
import randomfor roll in range(10):print(random.randrange(1, 6), end=' ') -
ANSWER-False
Which of the following statements is false?
1|Page
, CIT 486 Final Actual EXAM
A function definition begins with the def keyword, followed by the function name,
a set of parentheses and a semicolon (;).
When you change a function's code, all calls to the function execute the updated
version.
The following code calls square first, then print displays the result:
print('The square of 7 is', square(7))
The required parentheses contain the function's parameter list—a comma-
separated list of parameters representing the data that the function needs to
perform its task. - ANSWER-A function definition begins with the def keyword,
followed by the function name, a set of parentheses and a semicolon (;).
The following session calls the string object s's object's lower and upper methods,
which produce new strings containing all-lowercase and all-uppercase versions of
the original string, leaving s unchanged:
In [1]: s = 'Hello'In [2]: s.lower() # call lower method on string object sOut[2]:
'hello'In [3]: s.upper()Out[3]: 'HELLO'
After the preceding session, s contains 'HELLO'. - ANSWER-False
The following code produces different values are likely to be displayed each time
you run the code:
import randomfor roll in range(10):print(random.randrange(1, 6), end=' ') -
ANSWER-True
2|Page
, CIT 486 Final Actual EXAM
Based on the following function definition that can receive an arbitrary number of
arguments:
In [1]: def average(*args):...: return sum(args) / len(args)...:
which of the following statements is false? - ANSWER-All of the above are true.
The value of the expression of:
In [1]: floor(-3.14159) - ANSWER--4.0
Which of the following statements is false?
-Each function should perform a single, well-defined task.
-The following code calls function square twice. The first call produces the int
value 49 and the second call produces the int value 0:
In [1]: def square(number):...: """Calculate the square of a number.""" ...: return
number ** 2 ...: In [2]: square(7)Out[2]: 49In [3]: square(.1)Out[3]: 0
-The statements defining a function arewritten only once, but may be called "to
do their job" from many points in a program and as often as you like.
-Calling square with a non-numeric argument like 'hello' causes a TypeError
because the exponentiation operator (**) works only with numeric values. -
ANSWER-The following code calls function square twice. The first call produces
the int value 49 and the second call produces the int value 0:
In [1]: def square(number):...: """Calculate the square of a number.""" ...: return
number ** 2 ...: In [2]: square(7)Out[2]: 49In [3]: square(.1)Out[3]: 0
Based on the following function definition:
def rectangle_area(length, width):"""Return a rectangle's area.""" return length *
width
3|Page
, CIT 486 Final Actual EXAM
The following call results in results in TypeError because the order of keyword
arguments matters—they need to match the corresponding parameters' positions
in the function definition:
rectangle_area(width=5, length=10) - ANSWER-False
Which of the following statements is false?
-If randrange truly produces integers at random, every number in its range has an
equal probability (or chance or likelihood) of being returned each time we call it.
-We can use Python's underscore (_) digit separator to make a value like 3000000
more readable as 3_000_000.
-The expression range(6,000,000) would be incorrect. Commas separate
arguments in function calls, so Python would treat range(6,000,000) as a call to
range with the three arguments 6, 0 and 0.
-All of the above statements are true. - ANSWER-All of the above statements are
true.
What is the output of the following code:
min('yellow', 'red', 'orange', 'blue', 'green') - ANSWER-blue
What does the following for statement print?
for counter in range(4): print(counter, end=' ') - ANSWER-0 1 2 3
For variables x = 'a' and y = 'b', what will the following statement display:
print((x + y), 'and', (y + x)) - ANSWER-ab and ba
4|Page