wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming Quiz 4

Total questions: 20

Worksheet time: 11mins

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 will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
3.
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 
4.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
5.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
6.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

7.
What is python named after
a)
The snake
b)
Television show called Monty Python
8.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
9.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
10.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
11.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
12.
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
13.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
14.
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
15.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
16.
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
17.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
18.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
19.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
20.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error