Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming Quiz

Total questions: 39

Worksheet time: 20mins

Name
Class
Date
1.

What is the purpose of the print() function in Python?

a)

To add comments

b)

To create variables

c)

To display output

d)

To perform arithmetic operations

2.

Which of the following is an arithmetic operator in Python?

a)

+

b)

>

c)

==

d)

and

3.

What does the % operator do in Python?

a)

Adds two numbers

b)

Calculates the remainder

c)

Compares two values

d)

Multiplies two numbers

4.

What is the purpose of comments in Python?

a)

To create variables

b)

To explain code

c)

To execute code

d)

To format strings

5.

What is the essential question for Sprint 1.2?

a)

How to format strings?

b)

What are the different conditions in Python programming?

c)

How to do arithmetic calculations in Python?

d)

How to print arithmetic operations using the print function?

6.

What does an if statement do in Python?

a)

Executes code based on a condition

b)

Creates a loop

c)

Defines a function

d)

Declares a variable

7.

What is the difference between if and if-else?

a)

if-else has no conditions

b)

if-else is only for strings

c)

if-else executes alternative code

d)

if is used for loops

8.

What is a Boolean expression?

a)

An expression that creates lists

b)

An expression that formats strings

c)

An expression that returns true or false

d)

An expression that returns a number

9.

What is the purpose of the if-elif-else statement?

a)

To define a function

b)

To format strings

c)

To handle multiple conditions

d)

To create a loop

10.

What is the essential question for Sprint 3.1?

a)

How to format strings?

b)

How to print arithmetic operations?

c)

What are the different conditions in Python programming?

d)

How to add items to a list in Python?

11.

What does string slicing allow you to do?

a)

Change the string

b)

Access parts of a string

c)

Create a new string

d)

Delete a string

12.

Which method is used to add an item to a list?

a)

append()

b)

add()

c)

insert()

d)

extend()

13.

What is the essential question for Sprint 2.2?

a)

What are the different conditions in Python programming?

b)

How to do arithmetic calculations in Python?

c)

How to format strings?

d)

How is if-elif-else different from if and if-else?

14.

What is the purpose of the Student Grade Book project?

a)

To practice string formatting

b)

To learn about loops

c)

To create a game

d)

To manage student scores

15.

What does the term 'mutability' refer to in lists?

a)

The ability to delete a list

b)

The ability to create a list

c)

The ability to change the list

d)

The ability to sort a list

16.

Which of the following is NOT a comparison operator?

a)

<

b)

>

c)

++

d)

==

17.

What is the output of print(2 + 3)?

a)

2 + 3

b)

5

c)

23

d)

Error

18.

What is the purpose of the 'pass/fail' criteria in the Student Grade Book?

a)

To determine student grades

b)

To add comments

c)

To create a list

d)

To format strings

19.

What does the term 'indexing' refer to in strings?

a)

Accessing characters by position

b)

Formatting a string

c)

Creating a new string

d)

Deleting a character

20.

What is the essential question for Sprint 3.2?

a)

How to format strings?

b)

How to add items to a list in Python?

c)

How to do arithmetic calculations in Python?

d)

What are the different conditions in Python programming?

21.

Which of the following is a built-in method for lists?

a)

remove()

b)

delete()

c)

clear()

d)

print()

22.

What is the output of print('Hello, World!')?

a)

Error

b)

Hello World!

c)

Hello, World!

d)

'Hello, World!'

23.

What is the purpose of the 'format()' method in strings?

a)

To change the string's case

b)

To format strings with variables

c)

To delete parts of a string

d)

To create a new string

24.

What is the output of print(5 % 2)?

a)

2

b)

5

c)

1

d)

Error

25.

What is the purpose of the 'append()' method in lists?

a)

To add an item to the end

b)

To sort the list

c)

To remove an item

d)

To create a new list

26.

What is the essential question for Sprint 1.1?

a)

How to format strings?

b)

What are the different conditions in Python programming?

c)

How to print arithmetic operations using the print function?

d)

How to do arithmetic calculations in Python?

27.

What is the purpose of indentation in Python?

a)

To add comments

b)

To format strings

c)

To define code blocks

d)

To create variables

28.

What is the output of print('Python' + ' is fun!')?

a)

Python is fun!

b)

Error

c)

Python + is fun!

d)

Pythonisfun!

29.

What does the len() function do in Python?

a)

Calculates the length of a string or list

b)

Formats a string

c)

Creates a new list

d)

Deletes an item from a list

30.

What is the purpose of the 'return' statement in a function?

a)

To define a variable

b)

To end the function

c)

To pass data back to the caller

d)

To create a loop

31.

What is the output of print(3 * 4)?

a)

7

b)

Error

c)

12

d)

34

32.

Which of the following is a valid way to create a list in Python?

a)

list = ()

b)

list = []

c)

list = {}

d)

list = ''

33.

What does the 'len()' function do in Python?

a)

Creates a new list

b)

Deletes an item

c)

Returns the length of an object

d)

Formats a string

34.

What is the output of print(10 // 3)?

a)

Error

b)

4

c)

3.33

d)

3

35.

What does the 'break' statement do in a loop?

a)

Pauses the loop

b)

Ends the loop

c)

Continues to the next iteration

d)

Exits the program

36.

What is the purpose of the 'for' loop in Python?

a)

To iterate over a sequence

b)

To define a function

c)

To perform arithmetic operations

d)

To create a conditional statement

37.

What is the output of print('Hello' * 3)?

a)

Hello 3

b)

Hello + Hello + Hello

c)

HelloHelloHello

d)

Error

38.

What does the 'sorted()' function do in Python?

a)

Reverses a list

b)

Sorts a list

c)

Creates a new list

d)

Deletes a list

39.

What is the purpose of the 'input()' function in Python?

a)

To format strings

b)

To take user input

c)

To display output

d)

To create a loop