wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Worksheet MCQs

Total questions: 35

Worksheet time: 18mins

Name
Class
Date
1.

Who developed the Python programming language?

a)

Wick van Rossum

b)

Rasmus Lerdorf

c)

Guido van Rossum

d)

Niene Stom

2.

Which type of programming does Python support?

a)

Object-oriented

b)

Structured

c)

Functional

d)

All of the mentioned

3.

Is Python case sensitive when dealing with identifiers?

a)

No

b)

Yes

c)

Machine dependent

d)

None

4.

Which of the following is the correct extension of a Python file?

a)

.python

b)

.pl

c)

.py

d)

.p

5.

Is Python code compiled or interpreted?

a)

Both compiled and interpreted

b)

Neither compiled nor interpreted

c)

Only compiled

d)

Only interpreted

6.

All keywords in Python are in ________

a)

Capitalized

b)

Lower case

c)

UPPER CASE

d)

None of the mentioned

7.

What will be the output of print(4 + 3 % 5)?

a)

7

b)

2

c)

4

d)

1

8.

Which of the following is used to define a block of code in Python?

a)

Indentation

b)

Key

c)

Brackets

d)

All of the mentioned

9.

Which keyword is used for a function in Python?

a)

Function

b)

def

c)

Fun

d)

Define

10.

Which character is used for single-line comments in Python?

a)

//

b)

#

c)

!

d)

/*

11.

What will be the output of the given while loop code with i += 1?

a)

1 2 3

b)

SyntaxError

c)

1 2

d)

None

12.

Which of the following functions shows the Python version?

a)

sys.version(1)

b)

sys.version(0)

c)

sys.version()

d)

sys.version

13.

Python supports creation of anonymous functions using ________

a)

pi

b)

anonymous

c)

lambda

d)

none

14.

What is the order of precedence in Python?

a)

Exp, Par, Mult, Div, Add, Sub

b)

Exp, Par, Div, Mult, Add, Sub

c)

Par, Exp, Mult, Add, Div, Sub

d)

Par, Exp, Mult, Div, Add, Sub

15.

What does pip stand for in Python?

a)

Pip Installs Python

b)

Pip Installs Packages

c)

Preferred Installer Program

d)

All of the mentioned

16.

Which of the following is true for Python variable names?

a)

Only underscore & ampersand allowed

b)

Unlimited length

c)

All private members have leading & trailing underscores

d)

None

17.

What are the values of print(2**(3**2)), print((2**3)**2)?

a)

512, 64

b)

512, 512

c)

64, 512

d)

64, 64

18.

Which of these is the truncation division operator?

a)

|

b)

//

c)

/

d)

%

19.

Output of list(filter(bool, [1,0,2,0,'hello','', []]))?

a)

[1,0,2,'hello','', []]

b)

Error

c)

[1,2,'hello']

d)

[1,0,2,0,'hello','', []]

20.

Which is a built-in function in Python?

a)

factorial()

b)

print()

c)

seed()

d)

sqrt()

21.

What is the use of id() in Python?

a)

Object doesn’t have unique id

b)

Returns object identity

c)

All of the mentioned

d)

None

22.

The given decorator function can work with _____ parameters.

a)

Any number of

b)

0

c)

1

d)

2

23.

Which is not a core data type in Python?

a)

Tuples

b)

Lists

c)

Class

d)

Dictionary

24.

Which is the definition of packages in Python?

a)

A set of main modules

b)

A folder of Python modules

c)

Many Python files

d)

Programs using modules

25.

What is the output of len(["hello",2,4,6])?

a)

Error

b)

6

c)

4

d)

3

26.

What will be the output of the loop printing .upper() for 'abcd'?

a)

A B C D

b)

a b c d

c)

error

d)

ABCD

27.

What is the namespace lookup order in Python?

a)

Built-in → Global → Local

b)

Built-in → Local → Global

c)

Local → Global → Built-in

d)

Global → Local → Built-in

28.

What does this print: for i in [1,2,3,4][::-1]?

a)

4 3 2 1

b)

error

c)

1 2 3 4

d)

none

29.

What will be printed by print("a"+"bc")?

a)

bc

b)

abc

c)

a

d)

bca

30.

Which function is called when using format(f)?

a)

str()

b)

format()

c)

str()

d)

format()

31.

Which of the following is NOT a keyword in Python?

a)

pass

b)

eval

c)

assert

d)

nonlocal

32.

What will be printed by the tester class snippet?

a)

12

b)

224

c)

None

d)

Error

33.

What will be output of comparing id(q) == foo(q) where foo modifies list?

a)

Error

b)

None

c)

False

34.

Which arithmetic operator cannot be used with strings?

a)

*

b)

-

c)

+

d)

All of the mentioned

35.

Output of print("abc. DEF".capitalize())?

a)

Abc. def

b)

abc. def

c)

Abc. Def

d)

ABC. DEF