Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.

What is the maximum possible length of an identifier?

a)

16

b)

32

c)

64

d)

None of these above

2.

Who developed the Python language?

a)

Zim Den

b)

Guido van Rossum

c)

Niene Stom

d)

Wick van Rossum

3.

In which year was the Python language developed?

a)

1995

b)

1972

c)

1981

d)

1991

4.

In which language is Python written?

a)

English

b)

PHP

c)

C

d)

All of the above

5.

What do we use to define a block of code in Python language?

a)

Key

b)

Brackets

c)

Indentation

d)

None of these

6.

Which character is used in Python to make a single line comment?

a)

/

b)

//

c)

#

d)

!

7.

Which of the following statements is correct regarding the object-oriented programming concept in Python?

a)

Classes are real-world entities while objects are not real

b)

Objects are real-world entities while classes are not real

c)

Both objects and classes are real-world entities

d)

All of the above

8.

What is the method inside the class in python language?

a)

Object

b)

Function

c)

Attribute

d)

Argument

9.

Which of the following declarations is incorrect?

a)

_x = 2

b)

__x = 3

c)

__xyz__ = 5

d)

5x=9

10.

Why does the name of local variables start with an underscore discouraged?

a)

To identify the variable

b)

It confuses the interpreter

c)

It indicates a private variable of a class

d)

None of these

11.

Which of the following is not a keyword in Python language?

a)

val

b)

raise

c)

try

d)

with

12.

Which of the following statements is correct for variable names in Python language?

a)

All variable names must begin with an underscore.

b)

Unlimited length

c)

The variable name length is a maximum of 2.

d)

All of the above

13.

Which of the following declarations is incorrect in python language?

a)

xyzp = 5,000,000

b)

x y z p = 5000 6000 7000 8000

c)

x,y,z,p = 5000, 6000, 7000, 8000

d)

x_y_z_p = 5,000,000

14.

Which of the following words cannot be a variable in python language?

a)

_val

b)

val

c)

try

d)

_try_

15.

Which of the following operators is the correct option for power(ab)?

a)

a ^ b

b)

a**b

c)

a ^ ^ b

d)

a ^ * b

16.

Which of the following precedence order is correct in Python?

a)

Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

b)

Multiplication, Division, Addition, Subtraction, Parentheses, Exponential

c)

Division, Multiplication, Addition, Subtraction, Parentheses, Exponential

d)

Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

17.

Which one of the following has the same precedence level?

a)

Division, Power, Multiplication, Addition and Subtraction

b)

Division and Multiplication

c)

Subtraction and Division

d)

Power and Division

18.

Which of the following functions is a built-in function in python language?

a)

val()

b)

print()

c)

None of these

19.

Study the following function:

round(4.576)

What will be the output of this function?

a)

4

b)

5

c)

576

d)

6

20.

Which of the following is correctly evaluated for this function?

pow(x,y,z)

a)

(x**y) / z

b)

(x / y) * z

c)

(x**y) % z

d)

(x / y) / z