WGU E010 FoUndations oF
ProGramminG (Python) PracticE
QUEstions
sEction 1: VariablEs, data tyPEs,
and basic syntax (QUEstions 1–15)
1. What is the output of print(type()) in Python?
A. <class 'int'>
B. <class 'float'>
C. <class 'double'>
D. <class 'str'>
Answer: B
Rationale: In Python, the / operator performs true division and always returns a float, even
when numbers divide evenly. = 5.0, so type(5.0) is <class 'float'> .
2. Which of the following is a valid variable name in Python?
A. 2nd_place
B. my_var
C. my-var
D. class
Answer: B
Rationale: Python variable names must start with a letter or underscore, cannot contain
hyphens, and cannot be reserved keywords. 2nd_place starts with a digit, my-var contains a
hyphen, and class is a reserved keyword .
3. What is the data type of the value 3.14 in Python?
A. int
B. float
C. string
D. Boolean
Answer: B
Rationale: Numbers with a decimal point are of type float (floating-point). Integers have no
decimal point .
, 4. Given x = 5 and y = 2, what is the result of x // y?
A. 2.5
B. 2
C. 2.0
D. 1
Answer: B
Rationale: The floor division operator // returns the integer quotient and discards the
remainder. 5 // 2 = 2 .
5. Which operator is used to check if two values are equal in Python?
A. =
B. ==
C. !=
D. ===
Answer: B
Rationale: == is the equality comparison operator. = is assignment. != means not equal. ===
is not valid in Python .
6. What is the output of print(type(10))?
A. <class 'int'>
B. <class 'integer'>
C. 'int'
D. <int>
Answer: A
Rationale: The type() function returns the type object; printing it displays <class 'int'> .
7. What will the following code output? print(3 + 2 * 4)
A. 20
B. 14
C. 11
D. 24
Answer: C
Rationale: Operator precedence: multiplication before addition. 2 * 4 = 8, then 3 + 8 = 11 .
8. Which correctly converts the string "123" to an integer?
A. int("123")
B. integer("123")
C. str(123)
D. float("123")
ProGramminG (Python) PracticE
QUEstions
sEction 1: VariablEs, data tyPEs,
and basic syntax (QUEstions 1–15)
1. What is the output of print(type()) in Python?
A. <class 'int'>
B. <class 'float'>
C. <class 'double'>
D. <class 'str'>
Answer: B
Rationale: In Python, the / operator performs true division and always returns a float, even
when numbers divide evenly. = 5.0, so type(5.0) is <class 'float'> .
2. Which of the following is a valid variable name in Python?
A. 2nd_place
B. my_var
C. my-var
D. class
Answer: B
Rationale: Python variable names must start with a letter or underscore, cannot contain
hyphens, and cannot be reserved keywords. 2nd_place starts with a digit, my-var contains a
hyphen, and class is a reserved keyword .
3. What is the data type of the value 3.14 in Python?
A. int
B. float
C. string
D. Boolean
Answer: B
Rationale: Numbers with a decimal point are of type float (floating-point). Integers have no
decimal point .
, 4. Given x = 5 and y = 2, what is the result of x // y?
A. 2.5
B. 2
C. 2.0
D. 1
Answer: B
Rationale: The floor division operator // returns the integer quotient and discards the
remainder. 5 // 2 = 2 .
5. Which operator is used to check if two values are equal in Python?
A. =
B. ==
C. !=
D. ===
Answer: B
Rationale: == is the equality comparison operator. = is assignment. != means not equal. ===
is not valid in Python .
6. What is the output of print(type(10))?
A. <class 'int'>
B. <class 'integer'>
C. 'int'
D. <int>
Answer: A
Rationale: The type() function returns the type object; printing it displays <class 'int'> .
7. What will the following code output? print(3 + 2 * 4)
A. 20
B. 14
C. 11
D. 24
Answer: C
Rationale: Operator precedence: multiplication before addition. 2 * 4 = 8, then 3 + 8 = 11 .
8. Which correctly converts the string "123" to an integer?
A. int("123")
B. integer("123")
C. str(123)
D. float("123")