Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 6

Worksheet time: 4mins

Name
Class
Date
1.

Square brackets in an assignment statement will create which type of data structure?


( s=[] )

a)

List

b)

Dictionary

c)

Tuple

d)

Set

2.

What is the output of the following code?


str="pynative"

print(str[1:3])

a)

py

b)

yn

c)

yna

d)

pyn

3.

Select which true for Python function ( 2 answers)

a)

A function is a code block that only executes when called and always returns a value.

b)

A function only executes when it is called and we can reuse it in a program

c)

Python doesn’t support nested function

4.

Select true statements regarding the Python tuple

a)

We cannot remove the item from tuple and we cannot update items of the tuple

b)

We cannot delete the tuple

c)

We cannot remove the items from the tuple

d)

We can remove the item from tuple and we cannot update items of the tuple

5.

To use a module in another module, you must import it using an _______ statement.

a)

import

b)

print

c)

for

d)

while

6.

Comparing a dictionary to Python to a dictionary for words, ____________ is each word we look up_______ is definition of the word

a)

value, key

b)

method, value

c)

key, attribute

d)

key, value