Additional programming techniques Flashcards

1
Q

Array

A

Data structure that can hold a fixed number of data elements. Each data element must be of the same data type

The elements in an array are identified by their position in the array. This is known as the index. The first element in an array always has an index of 0

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

Traversing an array

A

To traverse (move through) an array a for loop can be used to display each data element in order

e.g. ArrayName = [“Dog”, “Cat”, “Snake”]
for name in ArrayName:
print(name)

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

‘Inserting’ a value in an array

A

In an array, the size is fixed so you cannot insert new values, but you can change the value of elements that already exist

e.g. ArrayName[3] = “Dog”

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

‘Deleting’ a value in an array

A

In an array the size is fixed so you cannot delete values, but you can overwrite them as blank

e.g. ArrayName[2] = “”

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

Searching an array

A

For large arrays, a for loop is needed to search through each element for a specific value

e.g. for name in ArrayName:
if name == “Dog”:
print(name)

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

SQL

A

Searches for data in a database

SELECT (from top layer of table)
FROM (table name)
WHERE

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