Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics

Total questions: 30

Worksheet time: 29mins

Name
Class
Date
1.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
2.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
3.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
4.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
5.

What will the output be from the following code?

print("Hello world!\nHello world!") (aka new line)

a)

Hello world! Hello world!

b)

Hello world!

Hello world!

c)

SyntaxError

d)

Hello world!

6.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
7.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
8.

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

9.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
10.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
11.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
12.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
13.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
14.

What symbol is used in python to assign values to a variable? x=coat

a)

equals =

b)

plus +

c)

forward slash /

d)

asterisk *

15.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
16.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
17.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
18.

What will be the output?

name = 'Dave'

greeting = "Good morning" + name

print (greeting)

a)

Good morning 'Dave'

b)

Good morning Dave

c)

Good morning name

d)

Good morning + Dave

19.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
20.
Why is it called 'Python'?
a)
The guy who created it loves snakes
b)
The guy who created it loves Monty Python films
c)
You can create a game on python called snake
d)
It was created by someone called Mr Python
21.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
22.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
23.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer 
24.

What would be an example of an integer or whole number?

a)

4

b)

2.5

c)

7.4

d)

9.4

25.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
26.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
27.

Everything that we want do display in a print() function must:

a)

be inside parentheses - ()

b)

quotation marks - ""

c)

be inside single quotation marks - ''

d)

be inside hash marks - #

28.
Select all the correct answers for float data type:
a)
True
b)
25.4
c)
34
d)
[Hello]
29.

Comments are added in programming to explain what's going on in the code. The computer does not recognize comments. How do you start a comment?

a)

With a ?

b)

With a #

c)

With an !

d)

With a &

30.

In Python, variables are black, functions are purple and strings are green? True or False

a)

True

b)

False