CNIT 155 STUDY GUIDE 2026 EXAM QUESTIONS AND
SOLUTIONS RATED A+
✔✔If you enter a bunch of letters in response to the input function, the input function
returns a string. - ✔✔True
✔✔What is the output of the following code?
n = 20
while (n <= 25):
print (n,"\n")
n = n + 1 - ✔✔20, 21, 22, 23, 24, 25
✔✔The expression 3 ** 3 - ( 6 - 2 ) / 2 has the value _____. Is it an integer or a float
value? __________________.
7, int
25, float
7, float
25, int - ✔✔25, float
✔✔What is max(3, 5, 1, 7, 4)? - ✔✔7
✔✔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 - ✔✔z
✔✔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 x in response to the prompt - ✔✔nothing, an error
occurs
✔✔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
✔✔What is NOT something that should usually be done when testing programs? -
✔✔Overlap the areas of testing.
✔✔What will be displayed?
ctr = 1
while (ctr <= 5):
ctr = ctr + 1
print(ctr) - ✔✔6
✔✔Which of the following is the right statement to import the random library in python?
from Random import **
import Random
from python import Random
from random import * - ✔✔from random import *
✔✔What's the output?
count = 0
loop = 0
while count < 4:
loop = loop + 1
count = count + 2
count = count + loop
print(count)
4
6
0
8 - ✔✔6
✔✔The # character means that - ✔✔Python should ignore it and any remaining
characters on the line
✔✔Which of the following statements about a programs main function is not true?
it must be called before it is defined
by convention, it is the first function to be called
all answers are not true
SOLUTIONS RATED A+
✔✔If you enter a bunch of letters in response to the input function, the input function
returns a string. - ✔✔True
✔✔What is the output of the following code?
n = 20
while (n <= 25):
print (n,"\n")
n = n + 1 - ✔✔20, 21, 22, 23, 24, 25
✔✔The expression 3 ** 3 - ( 6 - 2 ) / 2 has the value _____. Is it an integer or a float
value? __________________.
7, int
25, float
7, float
25, int - ✔✔25, float
✔✔What is max(3, 5, 1, 7, 4)? - ✔✔7
✔✔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 - ✔✔z
✔✔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 x in response to the prompt - ✔✔nothing, an error
occurs
✔✔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
✔✔What is NOT something that should usually be done when testing programs? -
✔✔Overlap the areas of testing.
✔✔What will be displayed?
ctr = 1
while (ctr <= 5):
ctr = ctr + 1
print(ctr) - ✔✔6
✔✔Which of the following is the right statement to import the random library in python?
from Random import **
import Random
from python import Random
from random import * - ✔✔from random import *
✔✔What's the output?
count = 0
loop = 0
while count < 4:
loop = loop + 1
count = count + 2
count = count + loop
print(count)
4
6
0
8 - ✔✔6
✔✔The # character means that - ✔✔Python should ignore it and any remaining
characters on the line
✔✔Which of the following statements about a programs main function is not true?
it must be called before it is defined
by convention, it is the first function to be called
all answers are not true