Arrays Flashcards

(6 cards)

1
Q

Creating and Declaring a 1D Array

A

DECLARE Scores: ARRAY [0 : 4] OF INTEGER

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

Creating and Declaring a 2D Array

A

DECLARE NamesAndNumbers : ARRAY[1:3, 1:2] OF STRING
1:3 = 3 rows → one for each person
1:2 = 2 columns → one for name, one for number

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

Assignment 2D Array

A

Players[3,1] ← “Holly”

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

Assignment 1D Array

A

Colours [4] ← “Red”

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

Iterating through a 2D Array

A

FOR Row ← 1 TO 30
FOR Column ← 1 TO 5
StudentScores[Row, Column] ← 0
NEXT Column
NEXT Row

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

Iterating through a 1D Array

A

FOR Index ← 1 TO 30
StudentNames[Index] ← “”
NEXT Index

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