wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

U2/L3 Kira HS

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the purpose of a comment in Python code?

a)

To execute a line of code

b)

To store data

c)

To help understand the code

d)

To create a loop

2.

Which symbol is used to start a comment in Python?

a)

$

b)

#

c)

@

d)

&

3.

What is the output of the following Python statement: print('Hello, Python!')?

a)

Hello, World!

b)

Hello, Python!

c)

'Hello, Python!'

d)

Error

4.

What type of error occurs when there is a mistake in the syntax of the code?

a)

Logical error

b)

Runtime error

c)

Syntax error

d)

Semantic error

5.

Which of the following is an arithmetic operation in Python?

a)

Concatenation

b)

Division

c)

Assignment

d)

Comparison

6.

What should you do if your code has typos, missing symbols, or incorrect formatting?

a)

Ignore the errors and run the code again.

b)

Check your code carefully and fix the errors.

c)

Add more print statements.

d)

Change the programming language.

7.

How do print statements and arithmetic help in coding?

a)

They make the code run faster.

b)

They allow you to give instructions and see results.

c)

They automatically fix errors in the code.

d)

They change the code's language.

8.

Why is it useful to include comments in your code, even if the computer doesn’t read them?

a)

To make the code run faster

b)

To help other programmers understand the code

c)

To increase the file size

d)

To confuse the compiler

9.

What should you do when your code gives you a syntax error?

a)

Ignore the error and continue coding

b)

Check the code for typos or missing elements

c)

Restart the computer

d)

Delete the entire code

10.

How does using print statements and arithmetic in Python help you communicate with the computer?

a)

They allow you to create graphics

b)

They enable you to perform calculations and display results

c)

They are used to write comments

d)

They help in saving files

11.

In the "Your Turn with Numbers!" activity, you used Python to solve problems using ____________ operations.

a)

Logical

b)

Arithmetic

c)

String

d)

Boolean

12.

Some examples of arithmetic operations in Python include addition, subtraction, multiplication, and division. Which of the following is NOT an arithmetic operation in Python?

a)

Addition

b)

Subtraction

c)

Concatenation

d)

Multiplication

13.

A ____________ ____________ is a mistake in the code that prevents it from running correctly.

a)

Syntax error

b)

Logic error

c)

Runtime error

d)

Semantic error

14.

One example of a syntax error is forgetting to close a ____________ or missing a ____________ in a print statement.

a)

Parenthesis, quotation mark

b)

Bracket, semicolon

c)

Quotation mark, parenthesis

d)

Curly brace, colon

15.

In the "Making Mistakes!" section, you learned that errors are a normal part of ____________ and can help you learn and improve.

a)

Programming

b)

Gardening

c)

Cooking

d)

Painting

16.

A _______________ _______________ is a command in Python used to display text or output to the console.

a)

print statement

b)

input statement

c)

if statement

d)

while loop

17.

A _______________ is a non-executable line in the code that helps explain or document what the code is doing.

a)

comment

b)

variable

c)

function

d)

loop

18.

In Python, you create a comment by starting the line with a _______________ symbol.

a)

#

b)

$

c)

@

d)

%

19.

When writing code, it’s important to use comments to make your code easier to _______________ and _______________.

a)

read, understand

b)

compile, execute

c)

delete, ignore

d)

encrypt, decrypt

20.

In the "Your Turn!" activity, you practiced using _______________ _______________ to communicate with the computer.

a)

print statements

b)

input devices

c)

mouse clicks

d)

binary code