wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Advanced Python Quiz1

Total questions: 10

Worksheet time: 11mins

Name
Class
Date
1.

To access mathematical functions in python, we need this line in our code.

a)

import math functions

b)

import math

c)

from python import math

d)

from py import mathematics

2.

What is the output of the given function call?

a)

9

b)

num=9

c)

print 9

d)

return 9

3.

Which of the following prints all letters in alpha? (More than one answer)

a)
b)
c)
d)
4.

What Python command takes the answer from the user and assigns it to ur_name variable.

a)

ur_name = val("Please enter your name")

b)

ur_name = input("Please enter your name")

c)

ur_name = print("Please enter your name")

d)

ur_name = answer("Please enter your name")

5.

What is the output of the given code?

a)

['cat','dog','elephant','tiger']

b)

['cat','dog','elephant']

c)

['dog','elephant','tiger']

d)

['dog','elephant','tiger','fox']

6.

What is the output of the given code?

a)

The car is awesome. The car wins the race

b)

The car wins the race

c)

The car is awesome

d)

ERROR

7.

Given this class, how would you make McQueen win the race?

a)

McQueen.win()

b)

McQueen(win)

c)

win.McQueen()

d)

win(McQueen)

8.

What is the output of the given code?

a)

This race car is awesome

b)

The car wins the race

c)

The car is awesome

d)

The car is awesome. The car wins the race

9.

What is the code to get a random value between 100 and 125?

a)

random(100,125)

b)

random.randint(100,125)

c)

random(125)

d)

random(randint)[100,125]

10.

Which of the following is true? (More than one answer)

a)

Stack uses FIFO (First In First Out) method

b)

Queue uses FIFO (First In First Out) method

c)

Stack uses LIFO (Last In First Out) method

d)

Queue uses LIFO (Last In First Out) method