topic 4

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/150

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:19 AM on 6/17/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

151 Terms

1
New cards

data type

a classification of data into groups according to the kind of data they represent

2
New cards

name the basic data types

integer, real, char, string, boolean

3
New cards

integer

used to represent whole numbers

4
New cards

real

used to represent numbers with fractional part / decimals

5
New cards

character

used to represent a single character such as a letter, digit or symbol

6
New cards

string

used to represent a sequence of characters

7
New cards

boolean

used to represent true or false values

8
New cards

casting

converting from one data type to another data type

9
New cards

binary

refers to a system of representing information using only 2 digits, 0 and 1

10
New cards

bit

smallest unit of digital information, either an ‘off’ (0) or an ‘on’ (1) state

11
New cards

byte

8 bits

12
New cards

character sets

a published collection of codes and corresponding characters which can be converted to unique binary numbers for computers to represent text

13
New cards

name the 2 most common character sets

ascii

unicode

14
New cards

ascii

character set that uses 7 bits to represent 128 characters - including English letters, digits, punctuations and control characters

15
New cards

extended ascii 

has 8 bits for 256 characters

16
New cards

ascii benefit and drawback

  • simple and compact

  • limited to English and basic symbols

17
New cards

unicode

32 bits - 140,000 characters. allows representation of characters from all languages and many symbols across different devices and platforms

18
New cards

signed binary numbers

used to represent both positive and negative binary numbers

19
New cards

unsigned binary numbers

used to represent positive binary numbers

20
New cards

how can you represent negative binary numbers

  • sign and magnitude

  • 2’s complement

21
New cards

sign and magnitude

the most significant bit is for the sign instead of 128. 0 = positive, 1 = negative

22
New cards

downside of sign and magnitude

  • loses the maximum size of numbers that can be stored

  • can have 2 values for 0

23
New cards

2’s complement

the most significant bit is -128

24
New cards

overflow errors

occurs when the sum of two binary numbers exceeds the given number of bits

25
New cards

what is one method of subtraction

convert the number you are subtracting into two’s complement and then add the two numbers

26
New cards

how do I convert a number into two’s complement

dont change the zeros until the first one which you should keep the same then flip the rest

27
New cards

what’s another method of subtraction 

you subtract normally

  • 0-0 = 0

  • 1-0 = 1

  • 0-1 is when you borrow one from the next column and it is worth 2 

28
New cards

hexadecimal

a base-16 number system that has numbers 0-9 and letters ABCDEF

29
New cards

why use hexadecimal

hexadecimal values are shorter than binary as 4 bits can be represented by one Hex character

hexadecimal values are faster / more reliable to read/write as it is more human friendly

30
New cards

potential uses of hexadecimal

  • debugging

  • configuring hardware devices

  • define colours

31
New cards

what does X subscript n mean

X in base N

32
New cards

mantissa

part of the number that holds the actual digits of the value , represents the precision of the number

33
New cards

exponent

controls how far the binary point moves, controls the scale of the number

34
New cards

what does positive/negative exponent do

positive exponent shifts it to the right

negative exponent shifts it to the left

35
New cards

normalising floating point binary

ensuring the decimal point starts with 01 or 10 to ensure a consistent format and make arithmetic and comparisons more straightforward

36
New cards

logical shifts

process of moving the bits in a binary number to the left or right by a specified number of places

37
New cards

result of left and right shift

left shift - x2

right shift - divide by 2

38
New cards

mask

a binary number used in bitwise operations to isolate, modify, or test specific bits in another binary value

39
New cards

why use a mask

  • extract certain bits

  • to flip bits

  • to set bits to 0 or 1

40
New cards

array

ordered , static set of elements of one data type 

41
New cards

what type of array is a 1d array

linear array

42
New cards

what can 2d arrays be visualised as 

a table 

43
New cards

what can 3d arrays be visualised as

a multi-page spreadsheet

44
New cards

how do you select an element in a 2d and 3d array

2d array : arrayname[x][y]
3d array : arrayname[x][y][z]

45
New cards

record

a row in a file and is made up of fields

46
New cards

What is the definition of a list?

A data structure consisting of a number of items, where the items can occur more than once.

47
New cards

What are the main differences between arrays and lists?

• Lists can store data non-contiguously whereas arrays store data in order.

• Lists can store data of more than one data type.

48
New cards

what does non-contiguously mean

they do not have to be stored next to each other in memory

49
New cards

What is a tuple?

An immutable, ordered set of values of any type.

50
New cards

What is the difference between a tuple and an array?

Tuples are initialised using regular brackets instead of square brackets.

51
New cards

immutable

it can’t be changed , can’t be added or removed once it has been created

52
New cards

What is a stack?

A last in first out data structure, where items can only be removed from and added to the top of the list

53
New cards

Give an example of where stacks may be used.

• Back button in a web page

• Undo buttons

54
New cards

What is a queue?

A first in first out data structure, where items are added to the end of the queue and removed from the front of the queue.

55
New cards

What does the operation isEmpty() do?

Checks to see if the stack is empty

56
New cards

What does the operation push(value) do?

Adds a new value to the top of the stack

57
New cards

What does the operation peek() do?

Returns the top value of the stack without removing it

58
New cards

What does the operation pop() do?

Returns and removes the value at the top of the stack

59
New cards

What does the operation size() do?

It returns the size of the stack

60
New cards

What does the operation isFull() do?

Checks to see if the stack is full.

61
New cards

What does the operation enQueue(value) do?

Adds the value to the end of the queue

62
New cards

What does the operation deQueue() do?

Removes the item from the start of the queue

63
New cards

What does the operation isEmpty() do?

It checks to see if the queue is empty

64
New cards

What does the operation isFull() do?

Checks to see if the queue is full

65
New cards

static data structure

size of the structure cannot change at run time

66
New cards

dynamic data structure

size of the structure can change at run time.

67
New cards

pointers in stacks :

a single pointer is used to point to the top item of the stack,

when a new item is pushed onto the stack the pointer is incremented and when an item is popped off the stack the pointer decrements to point to the new top of the stack

68
New cards

pointers in queues:

a pair of pointers point to the front and back of the queue

if an item is popped from the queue, it points to it and then points to the next item. if an item is pushed , the tail pointer increments by one to point to the new end of queue

69
New cards

Algorithm for insertion into a stack:

  • Check to see if the stack is full

2. If the stack is full report error and stop

3. Increment the stack pointer

4. Insert new data item into location pointed to by the stack pointer and stop

70
New cards

Algorithm for deletion/fetching from a stack:

1. Check to see if the stack is empty

2. If the stack is empty report an error and stop

3. Copy the data item in location pointed to by the stack pointer/ delete the data item

4. Decrement the stack pointer

71
New cards

Algorithm for insertion into a queue:

1. Check to see is the queue is full

2. If the queue is full report an error and stop

3. Insert new data item into location pointed to by the tail pointer

4. Increment the tail pointer and stop

72
New cards

Algorithm for deletion/fetching from a queue:

1. Check to see if the queue is empty

2. If the queue is empty report an error and stop

3. Copy data item in location pointed to by the front pointer/ delete the data item

4. decrement front pointer and stop

73
New cards

pointer

an object that stores a memory address

74
New cards

types of queues

linear queue, circular queue

75
New cards

linear queue

a queue implemented in a straight line. elements are added to the rear and removed from the front.

76
New cards

circular queue

static array that has a fixed capacity

77
New cards

difference between linear and circular queues

in a linear queue, if there is space at the front, you cannot reuse it as the tail only moves forward . you cant add new items in a fixed queue with free space unless everything shifts to the left .

In a circular queue, the tail pointer can wrap around to where there is free space so no space is wasted

78
New cards

linked list

a dynamic data structure that is used to hold an ordered sequence

each item is called a node and has a pointer

79
New cards

location of items in a linked list

in a linked list, the items which form the sequence do not have to be in contiguous data locations

80
New cards

how to delete from linked list

remove the pointer of the item and replace the pointer of any value that points towards it so no items point to it

81
New cards

graph

a set of vertices/nodes that are connected by edges/pointers.

82
New cards

types of graphs-

directed graph, undirected graph, weighted graph

83
New cards

directed graph

the edges can only be traversed in one direction

84
New cards

undirected graph

the edges can be traversed in both directions

85
New cards

weighted graph

a value is attached to each edge

86
New cards

how do computers process graphs

adjacent matrix, adjacency list

87
New cards

adjacency matrix

2d array that records relationship between each node and all the other nodes in the graph

88
New cards

adjacency list

a list which records the existence of an edge between each node and all of its neighbours

89
New cards

what are values of edges in unweighted graphs

1 for when an edge exists between 2 nodes, 0 for no edge

90
New cards

applications of graphs

social networks, transport networks, operating system

91
New cards

how to traverse a graph

breadth first search, depth first search

92
New cards

breadth first search

visit all the children of a vertex before moving on to its children

93
New cards

depth first search

visit all the children of the left most vertex and the backtrack to the next one

94
New cards

tree

a connected unweighted graph with no cycles

95
New cards

root node

the node at the very top of the structure

96
New cards

children

subsequent nodes below the current node

97
New cards

branches

the lines that join the nodes

98
New cards

terminal / leaf nodes

nodes without subtrees

99
New cards

binary trees

type of tree where each node is only allowed 2 children

100
New cards

what does each node contain in binary trees

left pointer, data, right pointer