wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python - Chapter 3 Practice Quiz

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

A variable in Python is...

a)

A named container that stores values.

b)

A function that executes code.

c)

A constant value that cannot be changed.

d)

An error encountered during execution.

2.

What does an assignment statement do in Python?

a)

It assigns a value to a variable.

b)

It performs arithmetic operations.

c)

It performs logical operations.

d)

It takes input from the user.

3.

In Python, the '=' symbol...

a)

denotes an assignment operation.

b)

denotes an equality check.

c)

denotes a comparison operation.

d)

denotes a subtraction operation.

4.

The left side of an assignment in Python must be...

a)

A literal

b)

A variable

c)

An expression

d)

A function call

5.

Which of the following is true about Python identifiers?

a)

They can include letters, digits, and underscores, but cannot start with a digit.

b)

They can start with a digit and include any characters.

c)

They must start with an underscore and can only include letters.

d)

They can only consist of digits.

6.

Python is case-sensitive. True or False?

a)

True

b)

False

7.

In Python, what is a floating-point number?

a)

A number with a fractional part, represented with a decimal point.

b)

A whole number without a fractional component.

c)

A number expressed in exponential notation only.

d)

A string representing a number.

8.

What happens when a float value is too large to be represented in Python?

a)

An OverflowError is raised

b)

It becomes infinity

c)

It returns NaN

d)

It remains unchanged

9.

In Python, what is an expression?

a)

It is a combination of values, variables, and operators that can be evaluated to produce a result.

b)

It is a data structure used to store multiple items.

c)

It is a library for creating and managing functions.

d)

It indicates a syntax error in Python.

10.

Best practice for naming variables in Python is:

a)

Use lowercase letters with underscores

b)

Use CamelCase

c)

Use all uppercase letters

d)

Use numbers only

11.

What are the basic arithmetic operators in Python?

a)

a) +, -, *, /

b)

b) %, **, //

c)

c) +, %, **, //

d)

d) -, *, %, //

12.

Fill in the blank: The operator ** is used for ________ in Python.

a)

exponentiation

b)

multiplication

c)

division

d)

modulo

13.

Which operator has the highest precedence in Python?

a)

**

b)

()

c)

*

d)

+

14.

True or False: In Python, the expression x += 1 is shorthand for x = x + 1.

a)

True

b)

False

15.

Fill in the blank: To prevent unintended execution in a Python script, use ________.

a)

if __name__ == "__main__":

b)

if __name__ != "__main__":

c)

if __name__ == "__start__":

d)

if __name__ == "__main__"

16.

What is the correct way to import a module in Python?

a)

import module_name

b)

include module_name

c)

require module_name

d)

module module_name

17.

Fill in the blank: The math module provides advanced mathematical functions such as ________.

a)

sqrt(x), pow(x, y), log(x, base)

b)

abs(x), round(x)

c)

min(x, y), max(x, y)

d)

factorial(x), degrees(x)

18.

Which of the following is a constant provided by the math module?

a)

math.pi

b)

math.sqrt

c)

math.sin

d)

math.log

19.

What is the benefit of using modules in Python programming?

a)

To enhance code organization by grouping related functionalities into separate files, improving reusability and maintainability.

b)

To decrease the speed of program execution.

c)

To increase the length and complexity of the code.

d)

To deliberately add errors to the code.

20.

Fill in the blank: In Python, floating-point numbers use ________ for scientific notation.

a)

e

b)

exp

c)

p

d)

10

21.

What do math functions provide?

a)

A) Basic operations

b)

B) Advanced operations

c)

C) No operations

22.

What is the variable in the code shown

a)

variable

b)

Name

c)

print

d)

name

23.

What is the output of the following Python code?

x = 5

y = 10

print(x * y)

a)

50

b)

15

c)

5

d)

10

24.

What will be the output of the following code?

x = 10

y = 5

print(x - y)

a)

5

b)

15

c)

10

d)

Error

25.

In Python, a variable needs to

a)

start with letter not number

b)

be stated before "print"

c)

have % symbols on either side

d)

Variable????? We don't need variables!!!!