Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python 1

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
2.
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 
3.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
4.
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
5.

What syntax can you use to insert a line break between strings so that they appear over new lines?

a)

/

b)

\n

c)

\l

d)

n

6.
What will the output be from the following code?
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
7.

What is Python

a)

High level programming language

b)

Software program

c)

Operating System

d)

Microsoft Application

8.

Which is the best definition of an algorithm?

a)

a line of computer code with input

b)

a process to be followed to solve a problem

c)

a programming language that uses symbols

d)

a description of a future event

9.

Which is the best definition of a variable?

a)

A unit of measurement used in programming

b)

A function used for inputting data

c)

A string that can never change

d)

A stored value with an associated name

10.

What is the correct code to ask for a user’s favourite animal and store it in memory?

a)

animal = input(“What is your favourite animal?”)

b)

input = animal(“What is your favourite animal?”)

c)

animal(“What is your favourite animal?”)

d)

input(What is your favourite animal?)

11.

What would be the output of the following code? - #print(“3 + 5”)

a)

No output

b)

8

c)

3+5

d)

Error message

12.

What would be the output of the following code? - print(“3 + 5”)

a)

No output

b)

8

c)

3+5

d)

Error message

13.

What would be the output of the following code? - print(3 + 5)

a)

No output

b)

8

c)

3+5

d)

Error message

14.

Which of these statements about while loops is true?

a)

While loops always execute the same number of times

b)

While loops always execute at least once

c)

While loops must have a condition

d)

While loops must not contain an “if” statement

15.

12. In Python, "Seventeen" is an example of what data type?

a)

string

b)

integer

c)

boolean

d)

float

16.

12. In Python, 17 is an example of what data type?

a)

string

b)

integer

c)

boolean

d)

float

17.

12. In Python, "17" is an example of what data type?

a)

string

b)

integer

c)

boolean

d)

float

18.

12. In Python, True or False is an example of what data type?

a)

string

b)

integer

c)

boolean

d)

float

19.

12. In Python, 1.5 is an example of what data type?

a)

string

b)

integer

c)

boolean

d)

float

20.

True or False: A syntax error means there is an error in the way a programme has been written. eg a spelling mistake, typo or missing character like a bracket or colon

a)

True

b)

False