EXAM 1 — PRACTICE PROBLEMS
University of Kentucky
Python · Circuits · Electricity · Multiple Choice
Exam-style questions with step-by-step solutions
Variables · Data Types · Operators · Voltage / Current / Resistance
Circuit Symbols · Ohm’s Law Concepts
,EGR 102 | UNIVERSITY OF KENTUCKY | EXAM 1 PRACTICE Updated Edition
SET 1 — Variables & Naming Rules
1. What does a variable do in a program?
a. Executes a loop automatically
b. Stores a value, object, or other data for later use
c. Deletes memory permanently
d. Compiles the entire program
Answer: b
Explanation:
A variable is a named storage location that holds a value (or object) so the program can use it later.
2. Which of the following is a valid Python variable name?
a. 36_array
b. initial.position
c. maclauren_sum
d. Big chonk
Answer: c
Explanation:
Rules: cannot start with a number, no spaces, no periods, avoid keywords. maclauren_sum follows all rules.
3. Why is the name var considered a bad variable name?
a. It is too long
b. It starts with a number
c. It is a keyword / reserved word risk and is non-descriptive
d. It contains a period
Answer: c
Explanation:
var is treated as problematic (keyword-like / non-descriptive). Prefer clear names like count or total.
4. Which name is invalid because it starts with a number?
a. sum_total
b. 36_array
c. student_count
d. maclauren_sum
Answer: b
Explanation:
Python identifiers cannot begin with a digit. 36_array is illegal.
5. Which name is invalid because of a period?
a. initial_position
b. initial.position
c. initialPosition
d. initial_pos
Answer: b
Explanation:
Periods are not allowed in variable names (attribute access uses dots). Use underscore or camelCase instead.
Page 2
, EGR 102 | UNIVERSITY OF KENTUCKY | EXAM 1 PRACTICE Updated Edition
SET 2 — Operators, Assignment & Output
6. What is the output of the following code?
a = 21
b = (a + 4) // 7
c = a % 5
print(b)
print(c)
a. 3 then 1
b. 3.57 then 1
c. 25 then 4
d. 3 then 0
Answer: a
Explanation:
1. a + 4 = 25; 25 // 7 = 3 (integer division, no remainder).
2. 21 % 5 = 1 (remainder when 21 is divided by 5).
3. Output: 3 then 1.
7. What does the // operator do?
a. Regular division returning a float
b. Division with no remainder (floor / integer division)
c. Exponentiation
d. Modulus only
Answer: b
Explanation:
// performs floor division — quotient without the fractional part.
8. What does the % operator do?
a. Percentage calculation
b. Floor division
c. Gives the remainder after division
d. String formatting only
Answer: c
Explanation:
% is the modulus operator — remainder of integer division.
9. What is printed?
x = 3
y = x
x = 4
print(y)
a. 4
b. 3
c. Error
d. None
Answer: b
Explanation:
y = x copies the value 3 into y. Changing x later does not change y. print(y) → 3.
10. After the code below, what is the value of a?
a = 10
b = 3
a = a + b * 2
a. 16
Page 3