wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Lists

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.
A list is
a)
a single variable and its value
b)
an ordered list of values with one name
c)
a list of values, each with a different variable name
d)
an unordered set of values
2.
The lowest value in a list
a)
is at index position 0
b)
is at index position 1
c)
is at index position "zero"
d)
is at index position "one"
3.
To access the second value in the fred[ ] list, you would use
a)
fred[1]
b)
fred[2]
c)
fred(2)
d)
fred:2
4.
To get the number of values in the fred[ ] list, use
a)
len(fred)
b)
length(fred)
c)
fred[length]
d)
fred_length
5.
To create an empty list:
a)
MyList = [ ]
b)
Mylist = [ empty ]
c)
new(myList)
d)
MyList= 0
6.
MyList[4] = "Fred"
a)
only if position 4 already has a value
b)
is always possible
c)
only if position 4 already holds a String
d)
is impossible
7.
To add a value to a list, do
a)
MyList,append(5)
b)
MyList.grow(5)
c)
MyList = MyList + 5
d)
MyList[ end ] = 5
8.
To print out all the values in MyList:
a)
for x in MyList:<br /> print(x)
b)
print(MyList)
c)
print(all of MyList)
d)
this is impossible
9.
The best type of loop to use on a list is
a)
a FOR loop
b)
a WHILE loop
c)
an IF statement
d)
a print() statement
10.
Can a value in a list be overwritten with a new value?
a)
Yes
b)
No
c)
Only if it's a number
d)
Only if it's a String