wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Quiz Techno India

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

What datatype is the object below?

L = [1, 23, ‘hello’, 1]

a)

list

b)

dictionary

c)

array

d)

tuple

2.

Write the output of below code:

a = True

b = False

c = True

if not a or b:   

print ("a")

elif not a or not b and c:   

print ("b")

elif not a or b or not b and a:   

print ("c")

else:   

print ("d")

a)

a

b)

b

c)

c

d)

d

3.

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

a)

7

b)

1

c)

0

d)

5

4.

Operators with the same precedence are evaluated in which manner?

a)

Right to Left

b)

Left to Right

c)

Can’t say

d)

None of these

5.

Which one of the following has the highest precedence in the expression?

a)

Exponential

b)

Addition

c)

Multiplication

d)

Parentheses

6.

Suppose t = (1, 2, 4, 3), which of the following is incorrect?

a)

print(t[3])

b)

print(max(t))

c)

print(len(t))

d)

t[3] = 45

7.

What is called when a function is defined inside a class?

a)

Module

b)

Class

c)

Another function

d)

Method

8.

Which of these about a frozenset is not true?

a)

Mutable data type

b)

Allows duplicate values

c)

Data type with unordered values

d)

Immutable data type

9.

If a is a dictionary with some key-value pairs, what does a.popitem() do?

a)

Removes an arbitrary element

b)

Removes all the key-value pairs

c)

Removes the key-value pair for the key given as an argument

d)

Invalid method for dictionary

10.

test = {1:'A', 2:'B', 3:'C'}

test = {}

print(len(test))

a)

0

b)

3

c)

An exception is thrown

d)

None