wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Essentials 119

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following is the correct way to print the phrase "Hello, World!" in Python?

a)

print "Hello, World!"

b)

echo "Hello, World!"

c)

printf("Hello, World!")

d)

print("Hello, World!")

2.

What symbol is used to start a comment in Python?

a)

//

b)

/*

c)

#

d)

""

3.

Which of the following is a text-based programming language?

a)

Scratch

b)

Python

c)

Photoshop

d)

Excel

4.

What is the output of the following code snippet? ```python print("Python" + " " + "Rocks!") ```

a)

PythonRocks!

b)

Python Rocks!

c)

Python+Rocks!

d)

"Python" "Rocks!"

5.

How do you write a comment in Python that spans multiple lines?

a)

Using # at the beginning of each line

b)

Using /* at the beginning and */ at the end

c)

Using at the end

d)

Using triple quotes

6.

What is the correct file extension for Python files?

a)

.pyt

b)

.pt

c)

.py

d)

.python

7.

Which of the following is true about the print() function in Python?

a)

It can only print strings.

b)

It sends output to the console.

c)

It is used to read input from the user.

d)

It cannot print variables.

8.

What will be the output of the following code? ```python # This is a comment print("Comments are fun") # This is an inline comment ```

a)

This is a comment Comments are fun

b)

Comments are fun This is an inline comment

c)

Comments are fun

d)

No output, as the code contains comments

9.
used to structure code in Python
a)

whitespace or indentations (tab)

b)

curly braces { ; }

c)

booleans (T or F)

d)

variables (data)

10.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
11.

How will the following code look on the screen?

print ("I love programming.")

print ("I love programming.")

a)

"I love programming."

"I love programming."

b)

I love programming.

I love programming.

c)

I love programming. I love programming.

d)

I LOVE PROGRAMMING

I LOVE PROGRAMMING

12.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
13.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
14.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
15.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

16.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
17.

What Python command lets the user enter an answer to a prompt?

a)
answer()
b)
open()
c)
print()
d)
input()
18.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
19.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
20.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code