CSCE 110 MIDTERM EXAM 2025/2026
QUESTIONS AND ANSWERS 100% PASS
String, tuple, range, integer, float, Boolean - ANS List the data types in python that are
IMMUTABLE
list, dictionary, set - ANS List the data types in python that are MUTABLE
for, while - ANS Use a for/while loop when you know exactly how many times a loop needs
to run, and a for/while loop when you can't predict how often it repeats
docstring - ANS optional comments are called this
'''Hello'''
parentheses, index (slicing), exponent, multiplication/division/modulus, add and subtract,
comparisons, Boolean (not, and, then or) - ANS Order of operations in python
string, list, tuple, set, dictionary (NOT int, float, bool) - ANS data types in python that are
iterables
0, 1 - ANS For splicing x[a:b:c]:
1 @COPYRIGHT 2025/2026.
,if a is missing, the value is ___
if c is missing, the value is __
if b is missing, the value is the length of the string.
brackets, parentheses, squiggly braces, - ANS What are each of the following data structures
inclosed in:
lists
tuples
dictionaries and sets
sets are unordered and unindexed, dictionaries are ordered and mutable - ANS What is the
difference between sets and dictionaries?
5, 6, 7, 8, 9 - ANS range(5,10) returns what?
yes - ANS Can lists have heterogenous elements?
ex: ['dog', 78]
functions - ANS range() and main() are considered these in python
element - ANS in the list ['hello', 78], hello and 78 are called this.
{1, 2, 3, 'c', 'b', 'a'} - ANS what is the output of this union:
a = {1,2,3}
b = {'a', 'b', 'c'}
a|b
2 @COPYRIGHT 2025/2026.
,{2, 3} - ANS what is the output of this intersection:
a = {1,2,3}
b = {2,3,4}
a&b
print('Hello World') - ANS What is a correct syntax to output "Hello World" in Python?
my-var - ANS Which one is NOT a legal variable name?
my-var
Myvar
my_var
_myvar
print(type(x)) - ANS What is the correct syntax to output the type of a variable or object in
Python?
def myFunction(): - ANS What is the correct way to create a function in Python?
T - ANS T/F
In Python, 'Hello', is the same as "Hello"
x = "Hello"[0] - ANS What is a correct syntax to return the first character in a string?
x = "Hello"[0]
x = sub("Hello", 0, 1)
x = "Hello".sub(0, 1)
3 @COPYRIGHT 2025/2026.
, strip() - ANS Which method can be used to remove any whitespace from both the beginning
and the end of a string?
upper() - ANS Which method can be used to return a string in upper case letters?
replace() - ANS Which method can be used to replace parts of a string?
== - ANS Which operator can be used to compare two values?
dictionary - ANS What is this called?
{"name": "apple", "color": "green"}
list - ANS Which collection is ordered, changeable, and allows duplicate members?
set
list
dictionary
tuple
set - ANS Which collection does not allow duplicate members?
set
list
tuple
break - ANS Which statement is used to stop a loop?
4 @COPYRIGHT 2025/2026.
QUESTIONS AND ANSWERS 100% PASS
String, tuple, range, integer, float, Boolean - ANS List the data types in python that are
IMMUTABLE
list, dictionary, set - ANS List the data types in python that are MUTABLE
for, while - ANS Use a for/while loop when you know exactly how many times a loop needs
to run, and a for/while loop when you can't predict how often it repeats
docstring - ANS optional comments are called this
'''Hello'''
parentheses, index (slicing), exponent, multiplication/division/modulus, add and subtract,
comparisons, Boolean (not, and, then or) - ANS Order of operations in python
string, list, tuple, set, dictionary (NOT int, float, bool) - ANS data types in python that are
iterables
0, 1 - ANS For splicing x[a:b:c]:
1 @COPYRIGHT 2025/2026.
,if a is missing, the value is ___
if c is missing, the value is __
if b is missing, the value is the length of the string.
brackets, parentheses, squiggly braces, - ANS What are each of the following data structures
inclosed in:
lists
tuples
dictionaries and sets
sets are unordered and unindexed, dictionaries are ordered and mutable - ANS What is the
difference between sets and dictionaries?
5, 6, 7, 8, 9 - ANS range(5,10) returns what?
yes - ANS Can lists have heterogenous elements?
ex: ['dog', 78]
functions - ANS range() and main() are considered these in python
element - ANS in the list ['hello', 78], hello and 78 are called this.
{1, 2, 3, 'c', 'b', 'a'} - ANS what is the output of this union:
a = {1,2,3}
b = {'a', 'b', 'c'}
a|b
2 @COPYRIGHT 2025/2026.
,{2, 3} - ANS what is the output of this intersection:
a = {1,2,3}
b = {2,3,4}
a&b
print('Hello World') - ANS What is a correct syntax to output "Hello World" in Python?
my-var - ANS Which one is NOT a legal variable name?
my-var
Myvar
my_var
_myvar
print(type(x)) - ANS What is the correct syntax to output the type of a variable or object in
Python?
def myFunction(): - ANS What is the correct way to create a function in Python?
T - ANS T/F
In Python, 'Hello', is the same as "Hello"
x = "Hello"[0] - ANS What is a correct syntax to return the first character in a string?
x = "Hello"[0]
x = sub("Hello", 0, 1)
x = "Hello".sub(0, 1)
3 @COPYRIGHT 2025/2026.
, strip() - ANS Which method can be used to remove any whitespace from both the beginning
and the end of a string?
upper() - ANS Which method can be used to return a string in upper case letters?
replace() - ANS Which method can be used to replace parts of a string?
== - ANS Which operator can be used to compare two values?
dictionary - ANS What is this called?
{"name": "apple", "color": "green"}
list - ANS Which collection is ordered, changeable, and allows duplicate members?
set
list
dictionary
tuple
set - ANS Which collection does not allow duplicate members?
set
list
tuple
break - ANS Which statement is used to stop a loop?
4 @COPYRIGHT 2025/2026.