wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MDM_III_TA_2

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is an identifier in Python?

a)

A built-in function for string manipulation

b)

An identifier in Python is a name used to identify a variable, function, class, or other object.

c)

A type of data structure in Python

d)

A keyword used to define a function

2.

Which of the following is a keyword in Python?

a)

function

b)

def

c)

variable

d)

class

3.

What is the output of the expression 5 + 3 * 2?

a)

8

b)

16

c)

11

d)

10

4.

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

a)

1invalidVariable

b)

invalid-variable-name

c)

invalid variable name

d)

valid_variable_name

5.

What type of data does the input() function return?

a)

list

b)

string

c)

boolean

d)

integer

6.

What does the 'if' statement do in Python?

a)

The 'if' statement executes a block of code based on a condition.

b)

The 'if' statement is used to declare variables in Python.

c)

The 'if' statement defines a function in Python.

d)

The 'if' statement creates a loop in Python.

7.

What is the purpose of indentation in Python?

a)

To increase the speed of the program

b)

To make the code look more colorful

c)

To define variable types in Python

d)

The purpose of indentation in Python is to define code blocks and control flow.

8.

What will be the output of print('Hello, World!')?

a)

Hi, World!

b)

Hello, World!

c)

Hello, Universe!

d)

Hello World!

9.

What is the result of the expression True and False?

a)

True

b)

False and True

c)

False

d)

True or False

10.

What will be the output of print(2 ** 3)?

a)

6

b)

4

c)

8

d)

9

11.

What is the output of the following code: print(type(5))?

a)

list

b)

float

c)

str

d)

int

12.

Which keyword is used to define a function in Python?

a)

define

b)

def

c)

function

d)

method

13.

What will be the result of the expression 3 * 'abc' in Python?

a)

3abc

b)

None

c)

TypeError

d)

abcabcabc

14.

What will be the result of the expression 'Python' + '3'?

a)

Python3

b)

Python 3

c)

3Python

d)

Python + 3

15.

What is the output of the expression 4 * (3 + 2)?

a)

20

b)

15

c)

12

d)

10

16.

What is the output of the following code: print(type(5))?

a)

<class 'list'>

b)

<class 'float'>

c)

<class 'str'>

d)

<class 'int'>

17.

Which of the following data types is immutable in Python?

a)

Set

b)

String

c)

List

d)

Char

18.

What does the 'len()' function do in Python?

a)

Returns the length of an object

b)

Creates a new object

c)

Converts an object to a list

d)

Checks if an object is empty

19.

What is the output of the expression 10 // 3?

a)

3.0

b)

3

c)

3.33

d)

4

20.

Which of the following methods can be used to add an element to a list in Python?

a)

Both append() and insert()

b)

insert()

c)

add()

d)

append()