EXAM 1 QUESTIONS AND ANSWERS
What is a common word for the textual representation of a program? - CORRECT
ANSWER✅✅✅code
Which type of error does not cause the program to crash? - CORRECT ANSWER✅✅✅logic error
Basic instruction types are input, process, and _____. - CORRECT ANSWER✅✅✅output
Dividing by zero is an example of which type of error? - CORRECT ANSWER✅✅✅runtime
Which program can be used to create a Python file that can be used directly by the interpreter? -
CORRECT ANSWER✅✅✅IDLE editor
Which statement has a syntax error? Assume variables x, y, z, and age have already been defineD. -
CORRECT ANSWER✅✅✅x + y = z
What is the ending value of z?
x = 0.3z = math.pow(math.ceil(x), 2) - CORRECT ANSWER✅✅✅1.0
Which statement is true regarding the pop() method for sets? - CORRECT ANSWER✅✅✅pop()
removes a random item in the set.
15 _____ 3 = 5.0 - CORRECT ANSWER✅✅✅/
Which of the following expressions causes an implicit conversion between types? Assume variable x is
an integer, t is a float, and name is a string. - CORRECT ANSWER✅✅✅7.5 + (x / 2)
Which statement makes the code in the math module available? - CORRECT ANSWER✅✅✅import
math
, A _____ is a word that is part of the Python language and can't be used as a variable name. - CORRECT
ANSWER✅✅✅keyword
Which data type is the correct choice to store the names of all the hockey players who have scored 3 or
more goals in a single game in no specific order? - CORRECT ANSWER✅✅✅set
Which data type is the correct choice to store the number of wins associated with each basketball team
in the NBA? - CORRECT ANSWER✅✅✅dict
What is the base 10 representation of the binary number: 00101110? - CORRECT ANSWER✅✅✅46
What is the value of the __name__ built-in variable in a module that is executed as a script by the
programmer? - CORRECT ANSWER✅✅✅__main__
Which operator is evaluated last in an expression? - CORRECT ANSWER✅✅✅or
What conditions have to be true to make the following code display "B"?
if color == 'red':if style < 3:print('A')elif style < 5:print('B')else:print('C')elif color == 'blue':print('D') -
CORRECT ANSWER✅✅✅color is 'red' and style is 4
What is x's final value?
x = 10y = 20if y <= 2 * x:x = x + 5else:x = x * 2 - CORRECT ANSWER✅✅✅15
Which branch structure is necessary if a program needs to output "Yes" if a variable's value is positive,
or "No" otherwise? - CORRECT ANSWER✅✅✅if-else
What condition should replace ZZZ to output "Same name" only if the values of two variables are the
same?
my_name = input("Enter my name: ")your_name = input("Enter your name: ")if ZZZ:print("Same name")
- CORRECT ANSWER✅✅✅my_name == your_name