wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Fundamental 1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of "12"+"4"+"3"?

a)

1234

b)

1243

c)

10

d)

19

2.

What does the ** operator do in Python?

a)

It performs exponentiation (raising the left operand to the power of the right operand).

b)

It performs floor division (divides and rounds down to the nearest integer).

c)

It performs bitwise AND (compares each bit of the operands and returns 1 if both bits are 1).

d)

It performs addition (adds the numeric values of both operands).

3.

Which operator is used for string concatenation?

a)

+

b)

&

c)

|

d)

^

4.

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

a)

2things

b)

_myVar

c)

my-var

d)

None of the above

5.

What data type is the object below?
[1, 2.2, 'python']

a)

List

b)

Dictionary

c)

Tuple

d)

Set

6.

To check the data type of a variable a in Python, which function will you use?

a)

typeof(a)

b)

datatype(a)

c)

type(a)

d)

data_type(a)

7.

What does the expression None == None evaluate to?

a)

True

b)

False

c)

None

d)

Error

8.

Which function is used to add an element to a set in Python?

a)

append()

b)

add()

c)

insert()

d)

push()

9.

How can you add a new key-value pair to a dictionary named data? Assume data = {}.

a)
  • data.add('key': 'value')

b)

data['key'] = 'value'

c)

data.insert('key', 'value')

d)

data.append('key': 'value')

10.

What will be the output of len({'a':1, 'b':2, 'c':3})?

a)

3

b)

6

c)

None

d)

An error