Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming Fundamentals - Multiple Choice Questions

Total questions: 25

Worksheet time: 4mins

Name
Class
Date
1.

Python is a ______ language.

a)

High-level

b)

Low-level

c)

Assembly-level

d)

Machine-level

2.

Who developed Python programming language?

a)

James Gosling

b)

Guido van Rossum

c)

Dennis Ritchie

d)

Bjarne Stroustrup

3.

Which of the following is the correct extension of Python files?

a)

.p

b)

.py

c)

.pt

d)

.pyt

4.

What does indentation in Python signify?

a)

End of statement

b)

Start of a comment

c)

Grouping of statements

d)

Denotes error

5.

Which of the following is a valid variable name in Python?

a)

2num

b)

num_2

c)

num-2

d)

@num

6.

What is the output of the following code? x = 5 y = '5' print(x + int(y))

a)

55

b)

10

c)

Error

d)

5

7.

Which symbol is used to start a comment in Python?

a)

//

b)

/* */

c)

#

8.

Which of the following data types is immutable?

a)

List

b)

Dictionary

c)

Tuple

d)

Set

9.

What is the data type of the following? x = 3.14

a)

int

b)

float

c)

str

d)

complex

10.

What is the output of this code? print('Hello' + ' World')

a)

Hello World

b)

HelloWorld

c)

Hello+World

d)

Error

11.

Which function is used to take input from the user in Python?

a)

get()

b)

input()

c)

scan()

d)

enter()

12.

What is the result of this code? x = 10 y = 3 print(x // y)

a)

3.33

b)

3

c)

10.0

d)

3.0

13.

Which operator is used for exponentiation in Python?

a)

b)

**

c)

%

d)

//

14.

What will this code display? x = 5 x += 3 print(x)

a)

5

b)

3

c)

8

d)

Error

15.

Which keyword is used to define a function in Python?

a)

function

b)

define

c)

def

d)

fun

16.

Which of these is NOT a core data type in Python?

a)

Lists

b)

Tuples

c)

Class

d)

Dictionary

17.

Which function gives the data type of a variable?

a)

datatype()

b)

typeof()

c)

type()

d)

gettype()

18.

What is the output of this code? print(2 * 'Hi')

a)

HiHi

b)

2Hi

c)

Hi*Hi

d)

Error

19.

Which logical operator returns True if both operands are True?

a)

or

b)

not

c)

and

d)

nor

20.

What is the output of this code? for i in range(3): print(i)

a)

1 2 3

b)

0 1 2

c)

0 1 2 3

d)

1 2

21.

Which keyword is used to skip the current iteration in a loop?

a)

break

b)

stop

c)

continue

d)

pass

22.

What is the output of this statement? print(type((1, 2, 3)))

a)

b)

c)

d)

23.

What will this program output? def add(a, b): return a + b print(add(2, 3))

a)

23

b)

5

c)

2+3

d)

Error

24.

Which of the following statements is TRUE about Python?

a)

Python is compiled only

b)

Python is interpreted only

c)

Python is both compiled and interpreted

d)

Python is low-level

25.

Which of the following is used to represent a block of code with no action?

a)

break

b)

continue

c)

pass

d)

skip