10 - data types and structures Flashcards

1
Q

data type

A

a classification attributed to an item of data, which determines the types of value it can take and how it can be used

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

record

A

a composite data type
comprising several related items that may be of different data types

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

composite data type

A

a data type constructed using several of the basic data types available in a particular programming language

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

array

A

a data structure containing several elements of the same data type
position of each element if found using the index
the first index is the lower bound and the last is the upper
can be 1D or 2D

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

basic/ primitive data types

A

can be identified by commands in programming languages
boolean
character
date
integer
real
string

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

record data type in pseudocode

A

TYPE

<typename>
DECLARE <identifier> : <data>
END TYPE
</data></identifier></typename>

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

1D array pseudocode

A

is like a list
DECLARE <identifier> : ARRAY[LB:UB] OF <data></data></identifier>

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

2D arrays pseudocode

A

is like a table with rows and columns
DECLARE <identifier> : ARRAY[LB:UB, LB:UB] OF <data></data></identifier>

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

linear search

A

searches every item in order from the lower bound to the upper

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

linear search pseudocode

A

INPUT item
foudn <- FALSE
index <- 0
WHILE found = FALSE AND index<= LEN(array)
IF item = array[index]
found = TRUE
index = index + 1
IF found
OUTPUT ‘item found’

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

bubble sort pseudocode

A

upper = LEN(array)
WHILE swap = FALSE AND upper >0
FOR i <- 0 TO upper - 1
swap = FALSE
IF array[i] > array[i+1]
temp = array[i]
array[i] = array[i +1]
array[i + 1] = temp
swap = TRUE
upper <- upper -1

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

bubble sort

A

each element is compared with the next and swapped if in the wrong order
this is repeated until the end is reached
this is repeated until the whole list is ordered

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

files

A

store data
identified by a filename
contain a sequence of characters
can include an end of line character that enables the file to be read from and written to

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

file pseudocode

A

open file
OPEN <filename> FOR <filemode>
read/ write
READFILE <filename>, <variable>
WRITEFILE ''
to see if the file is at teh end
EOF(<filename>)
when the files not being used
CLOSEFILE < filename ></filename></variable></filename></filemode></filename>

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

ADT

A

abstract data type
- collect of data and set of operations on that data
eg stack queue linked list

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

stack

A

a list of several items operating by last in first out - items can be added (push) and removed (pop) - first added is last removed
has a top of stack pointer

16
Q

queue

A

a list of several items operating on first in first out - items can be added (enqueue) and removed (dequeue)

17
Q

linked list

A

a list of several items where each item points to the next item
contains pointers and nodes
start pointer points to first element
null pointer signals end eg points to -1

18
Q
A
19
Q

file opening mode

A

READ
WRITE
APPRND - adds data to end

20
Q

how to add/ delete stack

A

POP from the top of the stack
and PUSH to add to the top of stack

21
Q

how to add/ delete queue

A

add items to the end (enqueue)
remove items from the front (dequeue)

22
Q

hwo to add / delete linked list

A

doen need to change the position of any values just edit their pointers

23
Q

declaring a variable of a record type

A

DECLARE <variable> : <recordtype>
eg DECLARE bibi : person
bibi.name <- “bibi”
bibi.age <- 17</recordtype></variable>