110 Introduction to Programming —
Final Exam
150+ Practice Questions with Answers &
Rationales
COURSE TOPICS COVERED
COMP 110 teaches fundamental programming concepts that
are applicable across programming languages. The course
covers:
Topic Description
Variables & Data Integers, floats, strings, booleans; type conversio
Types variable scope
If/else statements, logical operators, comparison
Conditionals
operators
,Topic Description
for loops, while loops, definite vs. indefinite
Loops
iteration
Function definition, parameters, return values,
Functions
scope
Data Structures Lists, tuples, dictionaries, sets
Object-oriented programming, constructors,
Classes & Objects
methods, magic methods
Base cases, recursive cases, recursive data
Recursion
structures
Searching (linear, binary), sorting (bubble, merge
Algorithms
quick), algorithm analysis
Testing Unit testing, assertions, test-driven development
Ethics in
Social and ethical implications of software
Computing
,PART I: VARIABLES, DATA TYPES & EXPRESSIONS (Questions
1-25)
1. What is the output of the following code?
python
x=5
y=2
print(x / y)
• A) 2
• B) 2.5
• C) 3
• D) 2.0
• E) Error
Answer: B
Rationale: In Python 3, the / operator performs floating-
point division, returning a float. = 2.5.
2. What is the output of the following code?
python
, x=5
y=2
print(x // y)
• A) 2
• B) 2.5
• C) 3
• D) 2.0
• E) Error
Answer: A
Rationale: The // operator performs integer (floor) division,
returning the quotient without the remainder. 5 // 2 = 2.
3. What is the output of the following code?
python
x=5
y=2
print(x % y)
• A) 0
• B) 1