Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz - 5

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of the following code?

list == [1,2,3]

print list

a)

Syntax Error

b)

List

c)

[1,2,3]

d)

None of the above

2.

What is the output for the below code?

str = ['''hello''']

print(str)

a)

str

b)

hello

c)

['''hello''']

d)

['hello']

3.

What is the type of data in the below code?

print(type(90+1j))

a)

Float

b)

String

c)

Complex Numbers

d)

None of the above

4.

Which of the following enclose the input parameters or arguments of a function?

a)

Curly braces

b)

round braces

c)

Square Braces

d)

None of the above

5.

Which of the following keywords marks the beginning of the function block?

a)

Define

b)

key

c)

def

d)

Fun

6.

What is the output for the below code snippet?


def fun(message,num=3):

print(message*num)

fun('welcome')

a)

Error

b)

Welcome

c)

welcomewelcomewelcome

d)

None of the above

7.

What is the output for the below code snippet?


def func():

num = 3

print(num)


func()

a)

num

b)

func

c)

1

d)

3

8.

What is the output for the below code snippet?


def test(x = 1, y = 2):

x = x + y

print(x)


test()

a)

3

b)

4

c)

Error

d)

None of the above

9.

What is the output for the below code snippet?


list = [1,5,3]

list.sort()

print(list)

a)

[1,5,3]

b)

List

c)

sort

d)

[1,3,5]

10.

What does the min() function do?

a)

Gives the minimum function

b)

Gives the maximum function

c)

Gives the minimum and the maximum function

d)

None of the above