wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Comments in Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A line of text that Python won't try to run as code

a)

comment

b)

modulo

c)

variable

d)

boolean

2.

Which is used to make single line comments?

a)

#

b)

%

c)

**

d)

()

3.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
4.

___________ represents multi-line comments

a)

**

b)

"""

c)

#

d)

%

5.

Which of the following is correct?

a)

Comments are for programmers for better understanding of the program.

b)

Python Interpreter ignores comment.

c)

You can write multi-line comments in Python using triple quotes, either ''' or """.

d)

All of the above

6.

The spelling and grammar rules of a programming language is called

a)

GSP

b)

syntax

c)

code

d)

comments

7.

How to insert comments in Python ?

a)

/* this is a comment */

b)

// this is a comment

c)

# this is a comment

d)

''' this is a comment """

8.

What is the correct extension for python files ?

a)

.py

b)

.pyth

c)

.python

9.

What will the output be from the following code?

# print("This Program")

print("Hello world!")

a)

Hello world!

b)

SyntaxError

c)

This Program

Hello world

d)

print(Hello world!)

10.

Comments are used to

a)

Describe what is going to happen in a sequence of code.

b)

Document who wrote the code

c)

Turn off a line of code

d)

All of the above