M3R5 Python Basics MCQ

Practice M3R5 Python basics MCQ for Unit 1. Free Python basics quiz covering variables, data types, operators, and input/output. Test your Python fundamentals for O Level M3R5.

Python Basics MCQ - Unit 1 Practice

Master Python basics for O Level M3R5 with our comprehensive MCQ practice. Our Python basics MCQ covers variables, data types, operators, input/output, and fundamental Python concepts.

Python Basics MCQ Practice Questions

1

What is the output of 10 / 4 in Python 3?

A. 2
B. 2.5
C. 2
D. 3
2

What is the output of 10 // 4 in Python 3?

A. 2
B. 2.5
C. 2
D. 3
3

Which of the following is the logical AND operator in Python?

A. &&
B. and
C. &
D. AND
4

Is a 'comprehension' variable (e.g. [x for x in range(5)]) leaked to the outer scope in Python 3?

A. Yes
B. No
C. Only in lists
D. Only in dictionaries
5

What is the scope of a variable defined in a 'for' loop in Python?

A. Local to the loop
B. Global always
C. Same scope as the loop's parent
D. None
6

What does Python do if it cannot find a variable in any of the LEGB scopes?

A. Returns None
B. Assigns it a value
C. Raises a NameError
D. Creates it in the Global scope
7

What is the output of 'python'.capitalize()?

A. PYTHON
B. Python
C. pYTHON
D. Python.
8

What is the output of 'Python'.find('z')?

B. -1
C. Error
D. None
9

What is the output of 'Python'.index('z')?

B. -1
C. ValueError
D. IndexError
10

What is the output of 'python'[1:4]?

A. pyth
B. ytho
C. yth
D. yton

Master Python Basics

Get access to complete Python study material and practice tests

View Plans