wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 8 revision pack

Total questions: 61

Worksheet time: 30mins

Name
Class
Date
1.

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"

2.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
3.

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")

4.

What is the output of program below?


bicycles = ['trek', 'cannondale', 'redline', 'specialized']

print(bicycles[-1])

a)

trek

b)

cannondale

c)

redline

d)

specialized

5.

Which method is used to add a value at a specified position in the list?

a)

append

b)

extend

c)

insert

d)

pop

6.

Which symbols are used to open and close a list?

a)

( ) round brackets

b)

( ) curly brackets

c)

[ ] square brackets

d)

" " speech marks

7.

To add an item to the end of a list we use

a)

fruit.add("strawberries")

b)

fruit.append("strawberries")

c)

append(fruit("strawberries")

d)

("strawberries").append[fruit]

8.

To insert an item in the first position of a list we use

a)

fruit.append("strawberries, 1")

b)

fruit.insert("strawberries",0)

c)

fruit.insert(1, "strawberries")

d)

fruit.insert(0, "strawberries")

9.

variable.sort() will do what?

a)

Sort the list into alphabetical order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

10.

Which symbol do we use to create a list in Python?

a)

[]

b)

()

c)

{}

d)

""

11.

To show the first item only in the python list we use number....

a)

1

b)

0

c)

2

d)

-1

12.

To access the last item in the list, we can use number....​  

a)

1

b)

0

c)

-1

d)

2

13.

my_list = ['apple','orange','melon','papaya']

print(my_list[2])

What is the output?

a)

Apple

b)

Melon

c)

Orange

d)

Papaya

14.

student_list = ['Alex','John','Cattherine','Lexa')

student_list.append('Jemy')

print(student_list[-1]

a)

Jemy

b)

Alex

c)

Lexa

d)

Tomy

15.

The count() method returns the number of times the specified element appears in the list.

What is the output of this code?

a)

3

b)

2

c)

1

d)

0

16.

Output of this code?

a)

[2,4,6,8,10]

b)

['2','4','6','8','10']

c)

[0,2,4,6,8]

d)

[10,8,6,4,2]

17.

What is the index of “grape” in the list

[“apple”, “grape”, “orange”, “watermelon”]?

a)

0

b)

1

c)

2

d)

3

18.

What is the output of the following code?

list = []

list.append(1)

list.append(2.0)

list.append("vk")

print(list)

a)

[1, 2.0, 'vk']

b)

Error

c)

['vk', 1, 2.0]

d)

No putput

19.

To print a list called fruitList we use

a)

print(fruitList)

b)

list(print)

c)

fruitList.print()

d)

fruitList(print)

20.

This list contains items of what data type?

a)

String

b)

Boolean

c)

Float

d)

Integer

21.

If you want to create an empty list called colours, which of the following pieces of code is correct?

a)

colours = { }

b)

colours = ( )

c)

colours = [ ]

d)

colors = [ ]

22.

List items are ordered, changeable, and allow duplicate values.

a)

True

b)

False

23.

Lists are used to store single item in a single variable.

a)

True

b)

False

24.

List items are indexed, the first item has index [1], the second item has index [2] etc.

a)

True

b)

False

25.

When we say that lists are ordered, it means that the items have a defined order, and that order will not change.

a)

True

b)

False

26.

List items can be of any data type:

a)

True

b)

False

27.

If you add new items to a list, the new items will be placed at the end of the list.

a)

True

b)

False

28.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

29.
In programming, what is iteration?
a)
The repetition of steps within a program
b)
The order in which instructions are carried out
c)
A decision point in a program
d)
Testing a program to make sure it works
30.
Which of the following symbols is used in Python to mean "Equal to"?
a)
=
b)
!=
c)
==
d)
>=
31.
Which of the following symbols is used in Python to mean "Not equal to"?
a)
==
b)
!=
c)
<>
d)
><
32.

8. Which of the following symbols is used in Python to mean "Greater than or equal to"?

a)

<=

b)

>=

c)

>>

d)

=>

33.

Python is a

a)

text language

b)

database language

c)

programming language

34.

Python has a simple syntax similar to the

a)

coding language

b)

english language

c)

spanish language

35.

Code for Hello, World!

a)

print Hello, World!

b)

print("Hello, World!)

c)

print("Hello, World!")

36.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
37.
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
38.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
39.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
40.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
41.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
42.
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
43.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
44.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
45.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
46.

What will the output be from the following code? print("3+4")

a)

3+4

b)

7

c)

SyntaxError

d)

print(3+4)

47.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
48.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
49.
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
50.

chose which is a floating point

a)

14

b)

15.5

51.

chose a string

a)

"tim"

b)

"tim

c)

'tim'

d)

"tim

e)

tim

52.

is boolean true or false

a)

true only

b)

false only

c)

true and false only

53.

Which data type stores whole numbers?

a)

Float

b)

String

c)

Integer

d)

Char

54.

Which is the Python logo?

a)
b)
c)
d)
55.

What is an input?

a)

A command that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

56.

What is an output?

a)

A piece of data that is shown on the screen.

b)

Data that the user enters

c)

An output

d)

A orange

57.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

58.
What will the following code do? 
name = "Bob"
if name == "Bob": 
     print ("Hello " + name) 
else:  
     print ("I dont know you")
a)
prints bob
b)
prints Hello Bob
c)
nothing syntax error
d)
prints I don't know you
59.

What is a programming language?

a)

Written English

b)

An artificial language used to program a computer

c)

A language used in pseudocode

d)

Machine code

60.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
61.

The result of this program:

Friday = False

if Friday:

print "Jeans day!"

else:

print "Uniform day"

a)

Jeans day

b)

Today is Friday

c)

Uniform day

d)

Not Friday