wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

STARTER - 1D Array Test

Total questions: 48

Worksheet time: 39mins

Name
Class
Date
1.

Name of Data Structure that holds 1 value in programming?

(a)  

2.

Name of Data Structure that will store a collection of data.

(a)  

3.

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.

a)

True

b)

False

4.

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.


a)

True

b)

False

5.

Write the code to create a blank array called students

(a)  

6.

Write the code to create a blank array called shoppinglist

(a)  

7.

Write the code...

to OUTPUT all the cars.

(a)  

8.

Write the code...

to OUTPUT all the people.

(a)  

9.

Write the code...

to OUTPUT "Dave" from people array

(a)  

10.

Write the code...

to OUTPUT "Jen" from people array

(a)  

11.

Write the code...

to OUTPUT "BMW" from cars array

(a)  

12.

Write the code...

to add "Toyota" to start of array cars

(a)  

13.

Write the code...

to add "Jeep" to rear of array

(a)  

14.

Write the code...

to sort the array cars alphabetically

(a)  

15.

Write the code...

to sort the array people alphabetically

(a)  

16.

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)  

17.

Write the code...

to OUTPUT "Mini" from cars array

(a)  

18.

Write the code...

to remove "Jen" from array

(a)  

19.

Write the code...

to remove "Golf" from array cars

(a)  

20.

Write the code...

to remove "Golf" from cars using it index position

(a)  

21.

Name the operation that adds elements to the rear of a list/array...



(a)  

22.

Name the operation that removes an item from an array based upon its index value



(a)  

23.

Name the operation that sorts a list/array by alphabetical order



(a)  

24.

Write code that...

Outputs the length of cars array



(a)  

25.

Write code that...

Outputs the length of people array



(a)  

26.

Select what this code would output...

print(x[3])

a)

154

b)

634

c)

892

d)

345

27.

Select what this code would output...

print(x[0])

a)

154

b)

634

c)

892

d)

345

28.

Select what this code would output...

print(x[0:2])

a)

[154,634,892,345]

b)

[154,634]

c)

[634,892,345]

d)

[154,634,892]

29.

Select what this code would output...

print(x[1:4])

a)

[154,634,892,345]

b)

[154,634]

c)

[634,892,345]

d)

[154,634,892]

30.

What is the code an example of?

a)

How to add to an array

b)

How to check IF the array is of a certain size

c)

This code will check if a number entered by a user is in the array

d)

The code will not run, and contains syntax errors...

31.

What would be output?

x.append(1001)

(a)  

32.

What would be output?

x.remove(892)

(a)  

33.

What would be output?

x.pop(4)

(a)  

34.

How many times would print(i) run?

(a)  

35.

Apex = ["Caustic","Wraith","Lifeline"]

What data type are the elements in the array shown?

(a)  

36.

scores = [10,101,8]

What data type are the elements in the array shown?

(a)  

37.

temps = [10.5,1.7777,8.67,5.67]

What data type are the elements in the array shown?

(a)  

38.

How do you create a array

a)

car = ["Ford", "Volvo", "BMW"]

b)

car = "Ford", "Volvo", "BMW"

c)

car = "Ford" + "Volvo" + "BMW"

d)

car = ARRAY["Ford", "Volvo", "BMW"]

39.

How do you retrieve the first element of an array

a)

car[0]

b)

car[1]

c)

car.first

d)

car 0

40.

How do you add to a array

a)

cars.append("Honda")

b)

cars.add("Honda")

c)

cars + "Honda"

d)

cars.attach("Honda")

41.

How do you remove a element from a array

a)

cars.pop(1)

b)

cars.delete(1)

c)

cars[1].remove

d)

cars[1].nuke

42.

a)

["a", "b", "c"]

b)

["a"]

c)

["a", "b"]

d)

[]

43.

a)

a

b)

b

c)

c

d)

Error

44.

a)

["c", "o", "k", "m", "m"]

b)

[ "o", "k", "m", "m"]

c)

["o", "k", "m"]

d)

["c", "o", "k", "m"]

45.

a)

Yes

b)

Error

c)

["a", "b", "c"]

d)

a

46.

a)

1

b)

2

c)

3

d)

4

47.

a)

["o"]

b)

["a", "b", "c", "o"]

c)

o

d)

["c", "o"]

48.

a)

["a", "c"]

b)

["b"]

c)

["a", "b", "c"]

d)

["a", "b", "c", "b"]