wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Day3 - Python STT

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which is the correct operator for power(xy)?

a)

X^y

b)

X**y

c)

X^^y

d)

None of the mentioned

2.

Which one of these is floor division?

a)

/

b)

//

c)

%

d)

None of the mentioned

3.

Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?

a)

Since “susan” is not a value in the set, Python raises a KeyError exception

b)

It is executed fine and no exception is raised, and it returns None

c)

Since “susan” is not a key in the set, Python raises a KeyError exception

d)

Since “susan” is not a key in the set, Python raises a syntax error

4.

Which of the following statements create a dictionary?

a)

d = {}

b)

d = {“john”:40, “peter”:45}

c)

d = {40:”john”, 45:”peter”}

d)

All of the mentioned

5.

The output of the code above is

a)

Key Error

b)

4

c)

Math

6.

Assume the key is the student's id and the value is the grade. Which of the following code will get the grade of student id 102?

a)

grades[102]

b)

grades.get(102)

c)

grades[2]

d)

grades[3]

e)

grades.key(102)

7.

What is the output of the code above

a)

3.9

b)

4

c)

Syntax error

8.

x = 5


print(x > 3 and x < 10)

a)

True

b)

False

9.

x = 5


print(not(x > 3 and x < 10))

a)

True

b)

False

10.

What is the answer of this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5