Font size
WorksheetsYear 8 revision pack
Total questions: 61
Worksheet time: 30mins
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
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"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
What is the output of program below?
bicycles = ['trek', 'cannondale', 'redline', 'specialized']
print(bicycles[-1])
trek
cannondale
redline
specialized
Which method is used to add a value at a specified position in the list?
append
extend
insert
pop
Which symbols are used to open and close a list?
( ) round brackets
( ) curly brackets
[ ] square brackets
" " speech marks
To add an item to the end of a list we use
fruit.add("strawberries")
fruit.append("strawberries")
append(fruit("strawberries")
("strawberries").append[fruit]
To insert an item in the first position of a list we use
fruit.append("strawberries, 1")
fruit.insert("strawberries",0)
fruit.insert(1, "strawberries")
fruit.insert(0, "strawberries")
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
Which symbol do we use to create a list in Python?
[]
()
{}
""
To show the first item only in the python list we use number....
1
0
2
-1
To access the last item in the list, we can use number....
1
0
-1
2
my_list = ['apple','orange','melon','papaya']
print(my_list[2])
What is the output?
Apple
Melon
Orange
Papaya
student_list = ['Alex','John','Cattherine','Lexa')
student_list.append('Jemy')
print(student_list[-1]
Jemy
Alex
Lexa
Tomy
The count() method returns the number of times the specified element appears in the list.
What is the output of this code?
3
2
1
0
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
What is the index of “grape” in the list
[“apple”, “grape”, “orange”, “watermelon”]?
0
1
2
3
What is the output of the following code?
list = []
list.append(1)
list.append(2.0)
list.append("vk")
print(list)
[1, 2.0, 'vk']
Error
['vk', 1, 2.0]
No putput
To print a list called fruitList we use
print(fruitList)
list(print)
fruitList.print()
fruitList(print)
This list contains items of what data type?
String
Boolean
Float
Integer
If you want to create an empty list called colours, which of the following pieces of code is correct?
colours = { }
colours = ( )
colours = [ ]
colors = [ ]
List items are ordered, changeable, and allow duplicate values.
True
False
Lists are used to store single item in a single variable.
True
False
List items are indexed, the first item has index [1], the second item has index [2] etc.
True
False
When we say that lists are ordered, it means that the items have a defined order, and that order will not change.
True
False
List items can be of any data type:
True
False
If you add new items to a list, the new items will be placed at the end of the list.
True
False
What is used to separate elements in a list?
Bracket
Comma
Full Stop
Space
8. Which of the following symbols is used in Python to mean "Greater than or equal to"?
<=
>=
>>
=>
Python is a
text language
database language
programming language
Python has a simple syntax similar to the
coding language
english language
spanish language
Code for Hello, World!
print Hello, World!
print("Hello, World!)
print("Hello, World!")
It displays an output
print(3+4)
What will the output be from the following code? print("3+4")
3+4
7
SyntaxError
print(3+4)
print(3*4+5)
chose which is a floating point
14
15.5
chose a string
"tim"
"tim
'tim'
"tim
tim
is boolean true or false
true only
false only
true and false only
Which data type stores whole numbers?
Float
String
Integer
Char
Which is the Python logo?
What is an input?
A command that allows us to ask the user to enter some data.
To plug in something.
Data displayed on a screen.
A function
What is an output?
A piece of data that is shown on the screen.
Data that the user enters
An output
A orange
x = 5
y = 6
print("x*y")
The code above displays the following:
11
x*y
Syntax Error
30
name = "Bob"
if name == "Bob":
print ("Hello " + name)
else:
print ("I dont know you")
What is a programming language?
Written English
An artificial language used to program a computer
A language used in pseudocode
Machine code
The result of this program:
Friday = False
if Friday:
print "Jeans day!"
else:
print "Uniform day"
Jeans day
Today is Friday
Uniform day
Not Friday
