wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Exploring Python Fundamentals

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the output of 3 + 2 in Python?

a)

4

b)

6

c)

3

d)

5

2.

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

a)

variable-name

b)

1variable

c)

variable@1

d)

variable1

3.

What data type is the result of 5 / 2 in Python 3?

a)

boolean

b)

string

c)

float

d)

integer

4.

How do you create a list in Python?

a)

my_list = {1, 2, 3}

b)

my_list = (1, 2, 3)

c)

my_list = '1, 2, 3'

d)

my_list = [1, 2, 3]

5.

What is the purpose of the 'len()' function in Python?

a)

The 'len()' function calculates the sum of numbers in a list.

b)

The 'len()' function checks if an object is empty or not.

c)

The 'len()' function converts an object to a string format.

d)

The purpose of the 'len()' function is to return the number of items in an object.

6.

Which operator is used for exponentiation in Python?

a)

//

b)

%%

c)

**

d)

^

7.

What will be the output of 'Hello' + 'World'?

a)

HelloWorld

b)

Hello+World

c)

Hello-World

d)

Hello World

8.

How do you check the type of a variable in Python?

a)

Use the 'type()' function.

b)

Use the 'checktype()' function.

c)

Utilize the 'var_type()' method.

d)

Apply the 'data_type()' command.

9.

What is the result of 10 % 3?

a)

1

b)

2

c)

3

d)

0

10.

Which of the following is not a built-in data type in Python?

a)

dictionary

b)

list

c)

array

d)

set

11.

What is the output of the expression '5' * 2?

a)

55.0

b)

25

c)

10

d)

55

12.

How do you define a function in Python?

a)

create function_name(parameters)

b)

function_name(parameters) =>

c)

def function_name(parameters):

d)

function_name: parameters ->

13.

What is the difference between '==' and 'is' in Python?

a)

The '==' operator checks for value equality, while 'is' checks for object identity.

b)

The '==' operator checks for reference equality, while 'is' checks for value equality.

c)

The '==' operator compares types, while 'is' compares values.

d)

The '==' operator checks for object identity, while 'is' checks for value equality.

14.

Which keyword is used to define a class in Python?

a)

define

b)

function

c)

module

d)

class

15.

What will be the output of the following code: print(type([]))?

a)

b)

c)

d)

16.

How do you create a dictionary in Python?

a)

You can create a dictionary in Python using curly braces, e.g., {'key': 'value'}.

b)

Dictionaries in Python are created with parentheses, e.g., ('key', 'value').

c)

You can create a dictionary in Python using square brackets, e.g., ['key': 'value'].

d)

To create a dictionary in Python, use a list, e.g., ['key', 'value'].

17.

What is the output of 'abc' in uppercase?

a)

ABc

b)

ABC

c)

abc

d)

aBc

18.

Which operator is used to concatenate strings in Python?

a)

&

b)

-

c)

+

d)

|

19.

What is the result of the expression 2 ** 3?

a)

4

b)

6

c)

10

d)

8

20.

How do you create a tuple in Python?

a)

You create a tuple in Python by using brackets, e.g., [1, 2, 3].

b)

You create a tuple in Python by using angle brackets, e.g., <1, 2, 3>.

c)

You create a tuple in Python by using parentheses, e.g., (1, 2, 3).

d)

You create a tuple in Python by using curly braces, e.g., {1, 2, 3}.