wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Fundamentals - Epsiode 02

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

What is the output of the following


x = 36 / 4 * (3 + 2)

print(x)

a)

45

b)

37

c)

117

d)

The Program executed with errors

2.

What is the output?

a)

condition

b)

True

c)

Program has a syntax error.

d)

3 > 2

3.

__________ keyword is used for creating a function in Python.

a)

define

b)

fun

c)

def

d)

function

4.

What will the output be from the following code?
print("Python 3" * 2)

a)
TypeError
b)

Python 3Python 3

c)

Python 6

d)

Python 3 * 2

5.

Which of the following refers to Math Module function?

a)

sqrt

b)

rhombus

c)

add

d)

calculate

6.

Which of the following is a not equal operator?

a)

!=

b)

<>

c)

><

d)

==

7.

What will be the output of the following Python code?

a)

9

b)

3

c)

27

d)

30

8.

What is the output of the given code?

a)

10 20 10

b)

10

c)

20

d)

10 20

9.

Select the advantages of functions

a)

Modular programming

b)

Code re-usability

c)

Improving clarity of the code

d)

All the above

10.

What is the data type of print(type(15))

a)
hex
b)
int
c)
hexint
d)

error

11.

What are the possible output of random.randint(0, 3)?

a)

0, 1, 2

b)

0, 3

c)

0, 1, 2, 3

d)

none of the above

12.

What is the output of the given code?

a)

10 20 10 20

b)

10 20 10

c)

10 20 20

d)

Error

13.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
14.

What will it print?

a)
nothing
b)
5
c)
6
d)
an error message
15.

What is the value printed when this loop completes?

a)

2

b)

8

c)

12

d)

20

16.

What term is used to describe data passed into a function?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

17.

Find the correct output for the code print(len(value)) :

value = "Welcome!"

a)

6

b)

7

c)

8

d)

9

18.

Fill in the line of code for calculating the factorial of a number?

a)

num*fact(num-1)

b)

(num-1)*(num-2)

c)

num*(num-1)

d)

fact(num)*fact(num-1)

19.
How many times will Boo print?
a)
none
b)
4
c)
5
d)
1
20.

What does the following code output?

a)

11, 9

b)

16, 16

c)

None, None

d)

225, 117