ACTUAL EXAM| E010 FOUNDATIONS OF
PROGRAMMING (PYTHON) OA FINAL EXAM WITH
COMPLETE REAL EXAM QUESTIONS AND CORRECT
VERIFIED ANSWERS/ ALREADY GRADED A+
Question 1: What is the output of the following code?
python
x=5
y = 10
print(x + y)
A) 510
B) 15
C) Error
D) 5 10
Correct Answer: B
Rationale: The + operator performs arithmetic addition when
both operands are integers (or numeric types). The values 5 and
10 are added together to produce the sum of 15. If the
1
,operands were strings, + would concatenate them, but here they
are integers, so numeric addition occurs .
Question 2: Which of the following is a valid variable name in
Python?
A) 2ndName
B) my-name
C) my_name
D) class
Correct Answer: C
Rationale: Python variable names cannot start with a digit
(eliminating 2ndName), cannot contain hyphens (eliminating my-
name), and cannot be reserved keywords like class (eliminating
class). Underscores are allowed and commonly used,
so my_name is valid .
Question 3: What is the output of the following code?
python
x = "5"
2
,y=2
print(x * y)
A) 10
B) Error
C) "55"
D) 5
Correct Answer: C
Rationale: When a string is multiplied by an integer, Python
repeats (concatenates) the string that many times. Here, the string
"5" is repeated 2 times, resulting in the string "55". This is known
as string replication .
Question 4: Which data type is immutable?
A) list
B) dict
C) set
D) tuple
Correct Answer: D
3
, Rationale: Tuples cannot be changed after creation, making them
immutable. Lists, dictionaries, and sets are all mutable data types
that can be modified after creation .
Question 5: What is the output of the following code?
python
print(type())
A) int
B) float
C) double
D) str
Correct Answer: B
Rationale: In Python, the division operator / always returns a
float, even if the numbers divide evenly. Therefore, 10 /
2 evaluates to 5.0, and type(5.0) returns float. Python does not
have a separate double type .
Question 6: What will this code print?
python
4