Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ECDL Python Lesson 14 recap

Total questions: 60

Worksheet time: 32mins

Name
Class
Date
1.
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
2.
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!
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.

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

5.
What is python named after
a)
The snake
b)
Television show called Monty Python
6.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
7.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
8.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
9.
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
10.
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
11.
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
12.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
13.
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
14.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
15.

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

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
16.

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

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
17.

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

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
18.
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
19.

What are the names of the two types of mode that are used in Python? Select two.

a)

Interactive mode

b)

Scratch mode

c)

Imperial mode

d)

Script mode

20.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
21.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
22.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
23.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
24.

A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly.

a)

True

b)

False

25.
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
26.

Which is the correct way to assign an integer to a variable?

a)

myNumber = 6

b)

myNumber = "6"

c)

myNumber = int("six")

d)

myNumber == 6

27.

What is the correct format of the print statement?

a)

print("Python is cool")

b)

print("Python is cool)

c)

print "Python is cool"

d)

print(Python is cool")

28.

What does this output?

print("T" + "G" + "I" + "F")

a)

TGIF

b)

T G I F

c)

TypeError

d)

NameError

29.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
30.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
31.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
32.
returns the remainder from division
a)
modulo
b)
exponments
c)
boolean
d)
variables
33.
a line of text that Python won't try to run as code
a)
comment
b)
modulo
c)
variable
d)
boolean
34.
symbol used for modulo
a)
%
b)
&
c)
#
d)
**
35.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
36.
changing the value of a variable
a)
reassign
b)
comment
c)
modulo
d)
boolean
37.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
38.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
39.
what is the code for a STRING in python?
a)
str
b)
stri
c)
stg
40.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
“You are aged to perfection!”
b)
"Wow, you are half a century old!"
c)
"You are a spring chicken!"
41.
I am 18 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
"You are aged to perfection"
b)
"Wow, you are half a century old!"
c)
"You are spring chicken!"
42.
Which function takes a users input
a)
print()
b)
int()
c)
input()
d)
def
43.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
44.
Which is the most appropriate data type for: "13th December"
a)
Float
b)
Boolean
c)
Integer
d)
String
45.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
46.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, Ann , Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "Ann", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "Ann", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, Ann, Harry, Harry]

47.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

d)

"Ann"

48.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "John", "Ann", "Larry"]

a)

nameList()

b)

nameList[1]

c)

NameList(4)

d)

nameList["4"]

49.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

50.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
51.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
52.

To print a list called fruitList we use

a)

print(fruitList)

b)

list(print)

c)

fruitList.print()

d)

fruitList(print)

53.

Which colour will be replaced with yellow?

a)

red

b)

green

c)

blue

d)

none, yellow will be added to the list

54.

This list contains items of what data type?

a)

String

b)

Boolean

c)

Float

d)

Integer

55.

Which symbols are used to open and close a list?

a)

( ) round brackets

b)

( ) curly brackets

c)

[ ] square brackets

d)

" " speech marks

56.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
57.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
58.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
59.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
60.
What will print ?
a)
cats eat mice
b)
mice get away
c)
unknown
d)
error message