CNIT 155 EXAM 1 REVIEW QUESTIONS
While loops are pretest loops (T/F) - Answers -True
Computers can create true random numbers (T/F) - Answers -False
sum_total is a legal python identifier (T/F) - Answers -True
In python, the division operator (/) gives a float result, even if both of the numbers are
integers (T/F) - Answers -True
The input function returns a Boolean if the user types in True (T/F) - Answers -True
String can be used as a sequence in a for loop (T/F) - Answers -True
The int function can be used to convert a string of digits into an integer (T/F) - Answers
-True
If you enter a bunch of letters in response to the input the function, the input function
returns a string (T/F) - Answers -True
in is a reserved word in Python (T/F) - Answers -True
if is a legal Python identifier (T/F) - Answers -False
Which of the following is an example of De Morgan's Law? - Answers -Not (not A or not
B) = A and B
What is printed by the last line of the following code:
x = 10
y = input("enter a letter:")
print(y)
Assume the user enters the letter z in response to the prompt. - Answers -nothing, an
error occurs
Which character starts a comment in a Python program? - Answers -#
Which of the following range function will result in a for loop counting backwards? -
Answers -range(3, 0, -1)
What is printed when the following code is executed?
for university in ('PU', 'IU', 'Butler')
print(university, "is a university") - Answers -PU is a university
IU is a university
While loops are pretest loops (T/F) - Answers -True
Computers can create true random numbers (T/F) - Answers -False
sum_total is a legal python identifier (T/F) - Answers -True
In python, the division operator (/) gives a float result, even if both of the numbers are
integers (T/F) - Answers -True
The input function returns a Boolean if the user types in True (T/F) - Answers -True
String can be used as a sequence in a for loop (T/F) - Answers -True
The int function can be used to convert a string of digits into an integer (T/F) - Answers
-True
If you enter a bunch of letters in response to the input the function, the input function
returns a string (T/F) - Answers -True
in is a reserved word in Python (T/F) - Answers -True
if is a legal Python identifier (T/F) - Answers -False
Which of the following is an example of De Morgan's Law? - Answers -Not (not A or not
B) = A and B
What is printed by the last line of the following code:
x = 10
y = input("enter a letter:")
print(y)
Assume the user enters the letter z in response to the prompt. - Answers -nothing, an
error occurs
Which character starts a comment in a Python program? - Answers -#
Which of the following range function will result in a for loop counting backwards? -
Answers -range(3, 0, -1)
What is printed when the following code is executed?
for university in ('PU', 'IU', 'Butler')
print(university, "is a university") - Answers -PU is a university
IU is a university