Arrays Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is an array?

A

A data structure that can store a collection of data values all under one name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is each piece of data in an array called?

A

An element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can each element be accessed by?

A

its position (index) in an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are 1 - Dimensional Arrays like?

A

Lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you create an array?

A

array rowers[4] -> number of elements the array can have
rowers[0] = Poo
repeat with 1,2,3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you retrieve an element from an array?

A

Using the name of the array and the element’s position
e.g. print(rowers[0])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you change an element in an array?

A

reassign the array position to a different data value
e.g. rowers[0] = Tom

How well did you know this?
1
Not at all
2
3
4
5
Perfectly