Questions and All Correct Answers.
Given that the customer file references a file object, and the file was opened using the 'w' mode
specifier, how would you write the string 'Mary Smith' to the file? - Answer customer.
Write('Mary Smith')
Python comes with ________ functions that have already been prewritten for the programmer.
- Answer standard
What will be the output after the following code is executed?
import matplotlib.pyplot as plt
def main():
x_crd = [0, 1 , 2, 3, 4, 5]
y_crd = [2, 4, 5, 2]
plt.plot(x_crd, y_crd)
main() - Answer Nothing; the number of x-coordinates do not match the number of y-
coordinates.
What will be the output after the following code is executed?
def pass_it(x, y):
z = x + ", " + y
return(z)
name2 = "Tony"
name1 = "Gaddis"
fullname = pass_it(name1, name2)
print(fullname) - Answer Gaddis, Tony
Which of the following is the correct if clause to determine whether choice is anything other
than 10? - Answer if choice != 10:
What will be displayed after the following code is executed?
, 9
What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8?
not (x < y or z > x) and y < z - Answer False
What does the following statement mean?
num1, num2 = get_num() - Answer The function get_num() is expected to return a value for
num1 and for num2.
The Python library functions that are built into the Python ________ can be used by simply
calling the required function. - Answer interpreter
The Python standard library's ________ module contains numerous functions that can be used
in mathematical calculations. - Answer math
The first line in a function definition is known as the function - Answer header
The disk drive is a secondary storage device that stores data by ________ encoding it onto a
spinning circular disk. - Answer magnetically
Which of the following will hide the turtle if it is visible? - Answer if turtle.isvisible():
turtle.hideturtle()
A ________ constant is a name that references a value that cannot be changed while the
program runs. - Answer global
A(n) ________ is a variable that receives an argument that is passed into a function. - Answer
parameter
What is a group of statements that exists within a program for the purpose of performing a
specific task? - Answer a function
What will be the value of the variable list after the following code executes?