wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Writing your first program in Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

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

a)

To save a program

b)

To display text on the console

c)

To create variables

d)

To upload files

2.

Which of the following is a correct way to write a comment in Python?

a)

/* This is a comment */

b)

// This is a comment

c)

# This is a comment

d)

<-- This is a comment -->

3.

What will the following code output? print('Hello World')

a)

Hello World

b)

Hello, World!

c)

Hello World!

d)

Hello

4.

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

a)

34

b)

12

c)

7

d)

3 x 4

5.

What is the first step to create a Python program according to the text?

a)

Run the program

b)

Write the code

c)

Open the Python editor

d)

Save the program

6.

Which of the following is NOT a feature of Python mentioned in the text?

a)

Open source

b)

Rich library of functions

c)

General-purpose programming language

d)

High cost

7.

What will the following code output? print('100-99=', 100-99)

a)

100-99=1

b)

1

c)

99

d)

100-99=0

8.

What is the purpose of the Run button in the Python editor?

a)

To upload files

b)

To clear the editor

c)

To execute the program

d)

To save the program

9.

What is the output of the following code? print('3 + 10 = '); print(3 + 10)

a)

3 + 10 = 13

b)

3 + 10 = 30

c)

3 + 10 = 10

d)

3 + 10 = 3

10.

What is the output of the following code? print('The product of 8 and 3 is 8x3')

a)

The product of 8 and 3 is 8/3

b)

The product of 8 and 3 is 8*3

c)

The product of 8 and 3 is 8x3

d)

The product of 8 and 3 is 24