5 - Fundamentals of Data Representation Flashcards
What is a natural number?
Natural numbers are positive whole numbers, including 0.
N = {0, 1, 2, 3, 4, …}
What is an integer?
Integers are positive and negative whole numbers including 0.
Z = {…, -3, -2, -1, 0, 1, 2, 3, …}
What is a rational number?
A rational number is any number that can be written as a fraction where the numerator and denominator are integers. (include values that can be expressed as fractions or ratios).
This includes integers and values with recurring values.
ℚ = {…, 2/1, 2/2, 2/3, 2/4, …}ℚ = {…, 2, 1, 0.6̇, 0.5, …}
What is an irrational number?
An irrational number is any number that cannot be represented as a fraction (or ratio), for example √2 or pi.
What are real numbers?
If a number is either rational, (an integer or a fraction) or irrational, it is considered to be a real number ℝ
Used for measurement.
R is the set of all “possible real world quantities”
What is an ordinal number?
Ordinal numbers are used to label the positions of objects in a list, ordered set or sequence of objects.
If we have the set S = {“a”, “b”, “c”, “d”}, then “a” is the 1st object, “b” is the second object, and so on.
What is a cardinal number?
A cardinal number identifies the size of something. For example, the size of a list.
What are natural numbers used for?
Natural numbers are used for counting (enumeration).
What are real numbers used for?
Real numbers are used for measurement.
What is binary?
Binary represents numbers using 2 digits, 0 and 1. Binary is base 2.
What is hexadecimal?
Hexadecimal represents numbers using 16 digits, the numbers 0 - 9 and the letters A - F. Hexadecimal is base 16.
What is decimal?
Decimal represents numbers using 10 digits, 0 - 9. Decimal is base 10.
What is a number base?
The number of symbols used to construct values eg. base 2, 10, 16.
How do you convert from Decimal to Binary?
eg.119₁₀
Set up the column headings and move from left to right putting a 1 under the combination of numbers that make up the decimal value.
eg.119 - 64 = 55 55 - 32 = 23 23 - 16 = 7 7 - 4 = 3 3 - 2 = 1 1 - 1 = 0
1286432168421
01110111
119₁₀→01110111₂
How do you convert from Binary to Decimal?
eg.11010111₂
Add up the column headings with a 1 under them.
eg.1286432168421
11010111
128 + 64 + 16 + 4 + 2 + 1 = 215
11010111₂→215₁₀
How do you convert from Decimal to Hexadecimal?
eg.527₁₀
Divide the decimal number by 16 (treating as integer division). Write down the remainder (in hexadecimal). Then repeat with the result of the division until the result is 0. The number in hexadecimal is the sequence of remainders in reverse order.
eg.527 DIV 16 = 32 527 MOD 16 = 1515 → F 32 DIV 16 = 2 32 MOD 16 = 0 2 DIV 16 = 0 2 MOD 16 = 2
256161
20F
527₁₀→20F₁₆
How do you convert from Hexadecimal to Decimal?
eg.C7F₁₆
Multiple each of the column headings by the value under them. The total is the decimal value.
eg.256161
C7F
256 * 12 + 16 * 7 + 1 * 15 = 3199
C7F₁₆→3199₁₀
How do you convert from Binary to Hexadecimal?
eg.10111110₂
Split the binary number into nibbles and find the hexadecimal value that represents each nibble.
eg.84218421
10111110
→B→E
10111110₂→BE₁₆
How do you convert from Hexadecimal to Binary?
eg.7D₁₆
Find the binary value that represents each digit of the hexadecimal number and join them together.
eg.↓7↓D
84218421
011111 01
7D₁₆→01111101₂
Why is hexadecimal used as a shorthand for binary?
- A hexadecimal value is much easier to read and remember than a string of binary digits
- Writing numbers in hexadecimal form is less error prone than writing the same numbers in binary.
- It is quicker to write or type, since a hex digit takes up only one character, not four.
- It can be displayed in less space.
What is hexadecimal used for?
- To define memory locations.
- To represent MAC addresses.
- To define colours on web pages.
What is a bit?
A bit is the fundamental unit of information. It is an abbreviation of binary digit. A bit can be either a 0 or a 1.
What is a byte?
What is a nibble?
A byte is a group of 8 bits.
A nibble is a group of 4 bits.
How many different values can be represented with n bits.
2ⁿ different values.