What is a variable?
An identifier/address in memory for a value stored in RAM
Extra info:
- use direct addressing type
- used to manipulate data behind the scenes
- some languages need explicit variable declarations - define variable name + type
What is a constant?
Like a variable but you can’t change the value stored in it - immutable
What is an array?
What are the features of an array?
What is a 2D array?
Eg. [[a,b],[c,d]]
To choose b:
- pseudocode - arr[0,2]
- python - arr[0][2]
what is a 3D array?
why would you use arrays of multiple dimensions?
do this to avoid using multiple arrays - you are the programmer so won’t forget what each array stands for
what is a record?
how do you declare a record in pseudocode?
(eg define record studentType with fields ID, firstname, surname, dateOfBirth, class)
how do you identify a field in a record
studentType = record
integer ID
string firstname
string surname
date dateOfBirth
string class
end record
variable must be declared first like this:
~~~
<variable> : <variableType>
<recordname>.<fieldname>
~~~
</fieldname></recordname></variableType></variable>
what is a tuple?
how do you define a tuple in python and refer to a value in it?
use parenthesis
pupil = ("John", 78, "a")
name = pupil[0]what is a list?
what are some common operations on a list?
when and how might an array be used instead of a list?
what is a linked list?
a set of data elements where each element contains:
- the data itself
- a pointer to the next element
what are the key features of a linked list?
what are the benefits of linked lists?
what are some drawbacks of linked lists?
how do you add a node to a linked list?
how do you delete a node from a linked list?
what is an abstract data type
a logical description of a data structure that specifies the operations that can be performed on it without detailing its implementation - allowing programmers to focus on functionality not internal workings, promoting modular + reusable code
eg. stacks, queues, linked lists, trees
what is a queue?
what are some applications of a queue?
what are the main operations on a queue?