CIS 101 PYTHON MIDTERM QUESTIONS WITH VERIFIED ANSWERS
python is a:
a. programming language
b. development environment
c. word processor
d. set of editing tools - Answers - a. programming language
what word is needed to output this line of code? ____("Hi")
a. print
b. enter
c. exit
d. output - Answers - a. print
What is the output of this code? print(8**(1/3))
a. 2
b. 3
c. 3.0
d. 2.0 - Answers - d. 2.0
What is the result of the following operation? print(1+4*3)
a. 12
b. 13
c. 11
d. 14 - Answers - b. 13
In python code what is the correct way to output text?
a. print("Hello")
b. write("Hello")
c. out("Hello")
d. output("Hello") - Answers - a. print ("Hello")
Rearrange the code to generate the following output:
A
B
C - Answers - print('A')
print('B')
print('C')
Fill in the blank with the output of this code: print(1+2+3+4.0+5)
a. 14.5
b. 15
c. 15.0
, d. 14 - Answers - c. 15.0
What is the output of this code? print(10//4)
a. 3
b. 2
c. 1
d. 0 - Answers - b. 2
what is the output of this code? print((4+8)/2)
a. 8
b. 6
c. 8.0
d. 6.0 - Answers - d. 6.0
Which line of code is correct?
a. (10**5)print
b. print 5(10**)
c. (10**) print 5
d. print (10**5) - Answers - d. print (10**5)
Which construct can be used to iterate through a list?
a. if statements
b. variable assignments
c. 1 int value
d. loops - Answers - d. loops
What is the output of this code?
spam=7
if spam>5:
print("five")
if spam>8:
print("eight")
a. nothing
b. five
c. eight
d. fiveeight - Answers - b. five
What is the result of this code?
nums=list(range(5,8))
print(len(nums))
a. 8
b. 5
c. 3
d. 4 - Answers - c. 3
What does this code output?
python is a:
a. programming language
b. development environment
c. word processor
d. set of editing tools - Answers - a. programming language
what word is needed to output this line of code? ____("Hi")
a. print
b. enter
c. exit
d. output - Answers - a. print
What is the output of this code? print(8**(1/3))
a. 2
b. 3
c. 3.0
d. 2.0 - Answers - d. 2.0
What is the result of the following operation? print(1+4*3)
a. 12
b. 13
c. 11
d. 14 - Answers - b. 13
In python code what is the correct way to output text?
a. print("Hello")
b. write("Hello")
c. out("Hello")
d. output("Hello") - Answers - a. print ("Hello")
Rearrange the code to generate the following output:
A
B
C - Answers - print('A')
print('B')
print('C')
Fill in the blank with the output of this code: print(1+2+3+4.0+5)
a. 14.5
b. 15
c. 15.0
, d. 14 - Answers - c. 15.0
What is the output of this code? print(10//4)
a. 3
b. 2
c. 1
d. 0 - Answers - b. 2
what is the output of this code? print((4+8)/2)
a. 8
b. 6
c. 8.0
d. 6.0 - Answers - d. 6.0
Which line of code is correct?
a. (10**5)print
b. print 5(10**)
c. (10**) print 5
d. print (10**5) - Answers - d. print (10**5)
Which construct can be used to iterate through a list?
a. if statements
b. variable assignments
c. 1 int value
d. loops - Answers - d. loops
What is the output of this code?
spam=7
if spam>5:
print("five")
if spam>8:
print("eight")
a. nothing
b. five
c. eight
d. fiveeight - Answers - b. five
What is the result of this code?
nums=list(range(5,8))
print(len(nums))
a. 8
b. 5
c. 3
d. 4 - Answers - c. 3
What does this code output?