wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Intermediate Quiz - 1

Total questions: 13

Worksheet time: 2mins

Name
Class
Date
1.

Choose the correct answer:

Arbitrary Keyword Arguments

a)

*a

b)

**a

c)

***a

d)

Arbitrary_kwargs

e)

*kwargs

2.

Choose the odd one out

a)

str

b)

int

c)

float

d)

dict

e)

def

3.

Which mode is used for only READING?

a)

"r"

b)

"a"

c)

"w"

d)

"read"

4.

Choose the correct line of code

a)

With open(file_path, file_mode) as file:

b)

with Open(file_path, file_mode) as file:

c)

with open(file_path, file_mode) as file:

d)

with open(file_path, file_mode):

e)

with os.open(file_path, file_mode) as file:

5.

How to get both the KEYS and VALUES of a dictionary

a)

dict.keys_&_values()

b)

dict.items()

c)

dict.all()

d)

dict.stuff()

6.

Keyword used to make a function

(Be careful with the case of the letters)

(a)  

7.

.listdir() is a function of the module 'x'

what is the name of the module 'x'?

a)

sys

b)

win32

c)

OS

d)

os

e)

operating_system

8.

x = ' Hello WolR!2D '

which function returns the value as "hello wolr!2d"?

a)

x.strip()

b)

x.lower()

c)

x.LOWER()

d)

x.normalize()

e)

x.strip().lower()

9.

the first keyword in the structure which is used to HANDLE ERRORS

(a)  

10.

How to add new things to a dictionary

a)

dict[x] = y

b)

dict.append(x,y)

c)

dict[x] is y

d)

dict.key(x)

dict.value(y)

11.

how to represent this in python:

xy

a)

x*y

b)

x^y

c)

x**y

d)

x exponent y

12.

NameError

a)

invalid functions

b)

a variable which doesn't exist

c)

incorrect spaces

d)

invalid syntax

13.

You will be making a python program.

You will receive the task in your chatbox

a)

Yes I can do it!

b)

No, I can't do it!