Font size
WorksheetsSTARTER - 1D Array Test
Total questions: 48
Worksheet time: 39mins
Name of Data Structure that holds 1 value in programming?
(a)
Name of Data Structure that will store a collection of data.
(a)
The contents of a list (array) can be changed while the program is running and lists (array) are one of the most common ways to store a collection of data under one name in Python Programming.
True
False
The data in a list does not all have to be of the same data type. Eg the same list can be used to store both strings and integers; however this can cause problems later and is therefore not recommended.
True
False
Write the code to create a blank array called students
(a)
Write the code to create a blank array called shoppinglist
(a)
Write the code...
to OUTPUT all the cars.
(a)
Write the code...
to OUTPUT all the people.
(a)
Write the code...
to OUTPUT "Dave" from people array
(a)
Write the code...
to OUTPUT "Jen" from people array
(a)
Write the code...
to OUTPUT "BMW" from cars array
(a)
Write the code...
to add "Toyota" to start of array cars
(a)
Write the code...
to add "Jeep" to rear of array
(a)
Write the code...
to sort the array cars alphabetically
(a)
Write the code...
to sort the array people alphabetically
(a)
Write the code...
to add "Hannah" to index position 1 (2nd position for a human) of array people.
Basically in front of "Christ" and "Jen" but behind "Dave".
(a)
Write the code...
to OUTPUT "Mini" from cars array
(a)
Write the code...
to remove "Jen" from array
(a)
Write the code...
to remove "Golf" from array cars
(a)
Write the code...
to remove "Golf" from cars using it index position
(a)
Name the operation that adds elements to the rear of a list/array...
(a)
Name the operation that removes an item from an array based upon its index value
(a)
Name the operation that sorts a list/array by alphabetical order
(a)
Write code that...
Outputs the length of cars array
(a)
Write code that...
Outputs the length of people array
(a)
Select what this code would output...
print(x[3])
154
634
892
345
Select what this code would output...
print(x[0])
154
634
892
345
Select what this code would output...
print(x[0:2])
[154,634,892,345]
[154,634]
[634,892,345]
[154,634,892]
Select what this code would output...
print(x[1:4])
[154,634,892,345]
[154,634]
[634,892,345]
[154,634,892]
What is the code an example of?
How to add to an array
How to check IF the array is of a certain size
This code will check if a number entered by a user is in the array
The code will not run, and contains syntax errors...
What would be output?
x.append(1001)
(a)
What would be output?
x.remove(892)
(a)
What would be output?
x.pop(4)
(a)
How many times would print(i) run?
(a)
Apex = ["Caustic","Wraith","Lifeline"]
What data type are the elements in the array shown?
(a)
scores = [10,101,8]
What data type are the elements in the array shown?
(a)
temps = [10.5,1.7777,8.67,5.67]
What data type are the elements in the array shown?
(a)
How do you create a array
car = ["Ford", "Volvo", "BMW"]
car = "Ford", "Volvo", "BMW"
car = "Ford" + "Volvo" + "BMW"
car = ARRAY["Ford", "Volvo", "BMW"]
How do you retrieve the first element of an array
car[0]
car[1]
car.first
car 0
How do you add to a array
cars.append("Honda")
cars.add("Honda")
cars + "Honda"
cars.attach("Honda")
How do you remove a element from a array
cars.pop(1)
cars.delete(1)
cars[1].remove
cars[1].nuke
["a", "b", "c"]
["a"]
["a", "b"]
[]
a
b
c
Error
["c", "o", "k", "m", "m"]
[ "o", "k", "m", "m"]
["o", "k", "m"]
["c", "o", "k", "m"]
Yes
Error
["a", "b", "c"]
a
1
2
3
4
["o"]
["a", "b", "c", "o"]
o
["c", "o"]
["a", "c"]
["b"]
["a", "b", "c"]
["a", "b", "c", "b"]
