1.4.1 Data Types Flashcards

1
Q

Primitive Data Types

A

“The basic data types provided by a programming language as building blocks. Most languages allow more complicated composite types to be recursively construction starting from basic types. E.g. char, integer, float, Boolean. As an extension a ‘string’ data type is constructed behind the scenes of many char data types.”

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

Integer

A

“A data type used to store positive and negative whole numbers

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

Real

A

“A data type used to store an approximation of a real number in a way that can support a trade-off between range and precision. A number is, in general, represented approximately to a fixed number of significant digits and scaled using an exponent.”

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

Floating Point

A

“A data type used to store an approximation of a real number in a way that can support a trade-off between range and precision. A number is, in general, represented approximately to a fixed number of significant digits and scaled using an exponent.”

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

Character

A

“A single alphanumeric character or symbol.”

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

String

A

“A sequence of alphanumeric characters and or symbols. e.g. a word or sentence.”

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

Boolean

A

“Used to store the logical conditions TRUE / FALSE. Often translated to On/Off, Yes/No etc.”

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

Binary

A

“Binary describes a numbering scheme in which there are only two possible values for each digit: 0 and 1. The term in computing refers to any digital encoding system in which there are exactly two possible states. E.g. in memory, storage, processing and communications, the 0 and 1 values are sometimes called “low” and “high”, respectively.”

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

Sign and Magnitude

A

“A method in computing of being able to store and represent floating point real numbers (both positive and negative) as a string of pure binary digits. Uses the concepts of two’s complements, mantissa and exponent.”

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

Two’s Complement

A

“A method in computing of being able to store negative numbers as string of pure binary digits. It works by turning the MSB into a sign bit, where 0 represents a positive number and 1 represents a negative.”

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

Hexadecimal

A

“A numerical system of notation which uses 16 rather than 10 as its base. The 16 Hex base digits are 0-9 and the letters A-F.”

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

Denary

A

“A numerical system of notation which uses 10 as its base. The 10 Decimal base digits are 0-9.”

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

Floating Point Arithmetic

A

“The mathematical process of performing simply calculations on more than one floating-point number stored in binary notation.”

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

Bitwise Manipulation

A

“The act of algorithmically manipulating bits or other pieces of data shorter than a word. Programming tasks that require a bit manipulation include low-level device control, error detection and correction algorithms, data compression, encryption algorithms, and optimisation.”

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

Shifts

A

“An operation that moves the bits held in a register, called the shift register, either to the left or the right. There are three different types of shift: arithmetic shift, logical shift and cyclic shift. They are distinguished by what happens to the bits that are shifted out of the register at one end and what is moved in to fill the vacant space at the other end.”

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

AND

A

“A logical operator used within a program. AND works by only returning TRUE if both values being compared are TRUE.”

17
Q

OR

A

“A logical operator used within a program. OR works by returning TRUE as long as either value being compared is TRUE.”

18
Q

XOR

A

“A logical operator used within a program. XOR stands for exclusive OR. It will return TRUE if the two items being compared are different.”

19
Q

Character Sets

A

“The set of symbols that may be represented in a computer at a particular time. These symbols, called characters, can be letters, digits, spaces or punctuation marks, the set includes control characters.”

20
Q

ASCII

A

America Standard Code for Information Interchange: “A character set devised for early telecommunication systems but proved to be ideal for computer systems. ASCII codes use 7-bits giving 32 control codes and 96 displayable characters (the 8th bit is often used for error checking).”

21
Q

UNICODE

A

“Standard character set that replaces the need for all the different character sets. It incorporates characters from almost all the world’s languages. It is a 16-bit extension of ASCII.”

22
Q

Adding data to a Linked List

A
  • Store the data at the location indicated by the free storage pointer
  • Alter the free storage pointer to the next free storage space
  • Work out where in the list the new item should be inserted
  • Set the pointer for the item that will precede it to the new data item
  • Update the pointer for the new data item to that previously stored in the item that preceded it
23
Q

Deleting data from a Linked List

A

IF item to remove is in first position THEN
Update starting pointer value to pointer value of item you want to delete
Update free pointers
EXIT PROCEDURE
ELSE
Update pointer value in the preceding node from the one you want to delete to the value of the pointer in item to be removed
Update free pointers
EXIT PROCEDURE
END IF

24
Q

Traversing a Linked List

A
Set the pointer to the start value
Repeat
   Go to node(pointer value)
   Output data at node
   Set the pointer to the value of the next item pointer at the pointer
Until pointer = 0
25
Q

Searching a Linked List

A
Set the pointer to the start value
Repeat
   Go to node(pointer value)
   IF data at node is search item
      output value and stop
   Else
      Set the pointer to value of next item pointer at the node
   Endif
Until pointer = 0
Output “data item not found”
26
Q

Traversing a Graph using the Depth-first method

A
  • PUSH the first vertex onto the stack
  • Mark vertex as visited
  • Repeat
  • Visit next unvisited vertex to the one on top of the stack
  • Mark as visited
  • PUSH vertex onto stack
  • IF no vertex to visit
  • POP vertex off stack
  • END IF
  • Until stack is empty
27
Q
  1. Traversing a Graph using the Breadth-first method
A
  • PUSH the first vertex onto the stack
  • Mark vertex as visited
  • Repeat
  • Visit unvisited vertex’s connected to first vertex
  • PUSH vertex’s onto queue
  • Until all vertex’s visited
  • Repeat
  • POP next vertex from queue
  • Repeat
  • Visit unvisited vertex’s connected
  • to current vertex
  • PUSH vertex onto queue
  • Until all vertex’s visited
  • Until queue is empty
28
Q

Inserting into a Binary Search Tree

A
  • If tree is empty enter data item at root and stop.
  • Current node = root.
  • Repeat steps 4 & 5 until current node is null.
  • If new data item is less than value at current node go left, else go right.
  • Current node = node reached (null if no node).
  • Create new node and enter data.
29
Q

Traversing a Binary Search Tree using the Preorder method

A
  • PREORDER_TRAVERSE(tree)
  • Visit root of tree
  • PREORDER_TRAVERSE(left subtree)
  • PREORDER_TRAVERSE(right subtree)
30
Q

Traversing a Binary Search Tree using the Inorder method

A
  • INORDER_TRAVERSE(tree)
  • INORDER_TRAVERSE(left subtree)
  • Visit root of tree
  • INORDER_TRAVERSE(right subtree)
31
Q

Traversing a Binary Search Tree using the Postorder method

A
  • POSTORDER_TRAVERSE(tree)
  • POSTORDER_TRAVERSE(left subtree)
  • POSTORDER_TRAVERSE(right subtree)
  • Visit root of tree
32
Q

Inserting into a Stack

A
  • Check to see if stack is full.
  • If the stack is full report an error and stop.
  • Increment the stack pointer.
  • Insert new data item into location pointed to by the stack pointer and stop.
33
Q

Deleting data / Reading from a Stack

A
  • Check to see if stack is empty.
  • If the stack is empty report an error and stop.
  • Copy data item in location pointed to by stack pointer.
  • Increment the stack pointer.
34
Q

Inserting into a Queue

A
  • Check to see if the queue is full.
  • If the queue is full report and error and stop.
  • Insert new data item into location pointed to by the head pointer.
  • Increment the head pointer and stop.
35
Q

Deleting data / Reading from a Queue

A
  • Check to see if queue is empty.
  • If the queue is empty report error and stop.
  • Copy data item in location pointed to by the tail pointer.
  • Increment tail pointer and stop.
36
Q

Searching a Hash Table

A
  • Feed in key to Hash function
  • Go directly to array index (HashValue)
  • IF (value = value searching for) THEN
  • Value found
  • ELSE
  • Follow linked list in sequence until
  • value found
  • END IF
37
Q

Inserting into a Hash Table

A
  • Feed in key to Hash function
  • Go directly to array index (HashValue)
  • IF (location is empty) THEN
  • Insert Value
  • ELSE
  • Follow linked list in sequence until
  • free space found
  • Insert Value
  • END IF
38
Q

Deleting data from a Hash Table

A
  • Feed in key to Hash function
  • Go directly to array index (HashValue)
  • IF (value = value searching for) THEN
  • Mark as empty
  • ELSE
  • Follow linked list in sequence until
  • value found
  • Mark as empty
  • Update free pointers in linked list
  • END IF