CNIT 155 Exam 1 Review
While loops are pretest loops (T/F)
True
Computers can create true random numbers (T/F)
False
sum_total is a legal python identifier (T/F)
True
In python, the division operator (/) gives a float result, even if both of the numbers
are integers (T/F)
True
The input function returns a Boolean if the user types in True (T/F)
True
String can be used as a sequence in a for loop (T/F)
True
The int function can be used to convert a string of digits into an integer (T/F)
True
If you enter a bunch of letters in response to the input the function, the input
function returns a string (T/F)
True
, in is a reserved word in Python (T/F)
True
if is a legal Python identifier (T/F)
False
Which of the following is an example of De Morgan's Law?
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.
nothing, an error occurs
Which character starts a comment in a Python program?
#
Which of the following range function will result in a for loop counting backwards?
range(3, 0, -1)
What is printed when the following code is executed?
for university in ('PU', 'IU', 'Butler')
print(university, "is a university")
PU is a university
IU is a university
Butler is a university
Which of the following is a correct syntax for a while loop?
While loops are pretest loops (T/F)
True
Computers can create true random numbers (T/F)
False
sum_total is a legal python identifier (T/F)
True
In python, the division operator (/) gives a float result, even if both of the numbers
are integers (T/F)
True
The input function returns a Boolean if the user types in True (T/F)
True
String can be used as a sequence in a for loop (T/F)
True
The int function can be used to convert a string of digits into an integer (T/F)
True
If you enter a bunch of letters in response to the input the function, the input
function returns a string (T/F)
True
, in is a reserved word in Python (T/F)
True
if is a legal Python identifier (T/F)
False
Which of the following is an example of De Morgan's Law?
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.
nothing, an error occurs
Which character starts a comment in a Python program?
#
Which of the following range function will result in a for loop counting backwards?
range(3, 0, -1)
What is printed when the following code is executed?
for university in ('PU', 'IU', 'Butler')
print(university, "is a university")
PU is a university
IU is a university
Butler is a university
Which of the following is a correct syntax for a while loop?