Assessment (OA) | Actual Full -Questions Exam with
Verified Answers & Rationales | 2025/2026 Edition|
INSTANT DOWNLOND PDF
1. Which of the following is the correct syntax to create a variable x with
value 10?
A. 10 = x
B. x := 10
C. x = 10
D. var x = 10
Rationale: In Python, variables are assigned using =.
2. What is the output of the following code?
print(type(3.14))
A. <class 'int'>
B. <class 'str'>
C. <class 'bool'>
D. <class 'float'>
Rationale: 3.14 is a float type in Python.
3. Which operator is used for exponentiation in Python?
A. ^
B. **
C. exp()
D. %
Answer: B
,Rationale: ** is used to raise a number to a power in Python.
4. How do you start a comment in Python?
A. //
B. <!--
C. /*
D. #
Rationale: Comments in Python start with #.
5. Which of the following is a valid list in Python?
A. (1, 2, 3)
B. {1, 2, 3}
C. [1, 2, 3]
D. <1, 2, 3>
Rationale: Lists in Python use square brackets [].
6. What is the output of the following code?
print("Python"[1])
A. P
B. y
C. t
D. y
Rationale: Python indexing starts at 0, so index 1 gives the second character y.
7. Which of the following is used to handle exceptions in Python?
, A. try-except
B. catch-try
C. error-handling
D. exception-catch
Answer: A
Rationale: Python uses try and except blocks to handle exceptions.
8. Which loop is used when the number of iterations is known?
A. while
B. for
C. do-while
D. loop
Rationale: for loops iterate over a sequence and are typically used when the
number of iterations is known.
9. How do you define a function in Python?
A. func myFunction():
B. def myFunction():
C. function myFunction():
D. define myFunction():
Rationale: Functions in Python are defined using def.
10. What is the output of the following code?
a = [1, 2, 3]
print(a[0:2])