wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python L1 Knowledge Check

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

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

a)

To save data to a file

b)

To read input from the user

c)

To display output on the console

d)

To perform mathematical calculations

2.

What is the purpose of the 'input' function in the code?

a)

To display a message to the user

b)

To store a value in a variable

c)

To get user input from the console

d)

To print the user's name and favorite color

3.

What is the purpose of the 'int()' function in the code?

a)

To convert the input into a string

b)

To convert the input into an integer

c)

To perform an addition operation

d)

To print a message to the user

4.

What is the purpose of a while loop?

a)

To iterate over a sequence such as range

b)

To exit a loop when a condition is met

c)


To convert all the characters in a string to lowercase

d)

To repeat a block of code as long as a specified condition is true

5.

What is commonly used with for loops to iterate a specific number of times?

a)

lower method

b)


while loop

c)

break statement

d)

range

6.

What does the break statement do?

a)


Converts all the characters in a string to lowercase

b)

Repeats a block of code indefinitely

c)

Generates a sequence of numbers

d)

Exits a loop, stopping the loop's execution based on a certain condition being met

7.

What is the lower() method used for?

a)

To generate a sequence of numbers

b)

To convert all the characters in a string to lowercase

c)

To iterate over a sequence such as range

d)

To exit a loop when a condition is met

8.

What is a list in Python?

a)

A function that executes a block of code a specific number of times.

b)


A single variable that is used to store different variable types.

c)

A container where you can put lots of different items in a specific order and change the contents anytime.

d)


A method to perform calculations on multiple variables.

9.

What are the values stored inside a list called?

a)

Elements

b)

Items

c)

Variables

d)

Indices

10.

What does zero-indexed mean in the context of lists?

a)


Lists start counting from 1.

b)

Lists start counting from 0.

c)

Lists can only have zero elements.

d)

Lists cannot have indexes.

11.

Which method is used to add a new item to the end of a list in Python?

a)

.add()

b)

.append()

c)

.insert()

d)

.attach()

12.

Which method is used to remove an item from a list in Python?

a)

delete()

b)

remove()

c)

pop()

d)


discard()

13.

What does the range() function in Python do?

a)

It generates a list of numbers within a specified range.

b)

It finds the maximum number in a list.

c)

It sorts a given list of numbers.

d)

It calculates the sum of numbers in a list.

14.

What is a function in programming?

a)

A command that ends the execution of the code.

b)

A variable used to store data.

c)

A block of reusable code designed to perform a specific task or calculation.

d)


A message displayed to the user.

15.

What keyword is used to define a function in Python?

a)

func

b)

def

c)

define

d)

function

16.

What is the purpose of declaring a variable as 'global' inside a function?

a)

To restrict the variable's access to the function only.

b)

To allow the variable to be accessed and modified from anywhere within the program.

c)

To ensure the variable can only be modified within the function.

d)

To delete the variable after the function's execution is complete.