Data Representation Flashcards
What are the different number bases?
Natural, integer, rational, irrational, real, ordinal
What numbers and what is the symbol for natural numbers?
N = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …}
What numbers and what is the symbol for integer numbers?
Z = { …, -2, -1, 0, 1, 2, 3, …}
What numbers and what is the symbol for rational numbers?
Q = a number that can be represented by a ratio of two numbers. E.g. 3/2
What are irrational numbers?
An irrational number is a number that cannot be represented by a ratio of integers e.g. π.
What are real numbers?
A real number is any positive or negative value and can include a fractional part.
What are ordinal numbers and what is the symbol for them?
Ordinal number asre those that identify the position of something within a list.
S = { “Anne”, “Asif”, “John”, …}
What are Natural numbers?
Natural numbers are the most recognisable type of number as they are the numbers that we use every day for counting and ordering. They are typically made up of decimal numbers.
What are integer numbers?
An integer number is a whole number whose value can be positive or negative. ( Zero is counted)
What are rational numbers?
A rational number is a number that can be represented as a fraction.
What are some uses of natural numbers in programming?
A counter of number of things in stock, score in video game etc, keep track of next instruction, identify next location of data, a counter for how many times a loop statement.
The use of real numbers in programming?
CNC machines need lots of accuracy to the millimeter, microwave cookers control and measure both time and temperature, power stations use data control systems to optimise production, robotic engineers use real time measurement of the environment in which the robot is working.
What is a bit?
A bit is a binary digit. It can hold the values of 1 or 0.
What is a byte
A byte is 8 bits. This is where we begin to measure the size of memory or disk space in terms of megabytes gigabytes and terabytes.
What is the difference between kibi bytes and kilo bytes? (And the rest of them)
Kibi (mebi Gigi tebi) is measured in binary therefore a kibibyte is 2^10. And a kilobyte is measured in decimal therefore 10^3
What are the three number bases we look at?
Base 10 - decimal
Base 2 - binary
Base 16 - hexadecimal
What are the uses of hexadecimal?
- Hex is used for, representing large digits with fewer digits
- Hex is used for, representing colour
- Hex is used for, Mac addresses
What is main advantage of Hex?
With 2 hex digits represents one byte. It is often referred to as shorthand for binary.
What is two’s compliment?
Two’s compliment is a method used to represent signed integer values. This means they can represent both positives and negatives.
What does two’s compliment do?
It makes the msb negative. Eg in 8 bit binary the msb with twos compliment the msb becomes -128.
To convert a negative integer into a binary you must? (Using two’s compliment)
For example to covert -102 to binary you:
First write out +102: 01100110
Then starting at the lsb write out the number until you reach the first 1.
Then reverse all the remaining bits.
So -102 is:
10011010
What is a fixed point number?
A fixed point member is a binary number that has decimal places.
What is a fixed point number?
A fixed point member is a binary number that has decimal places.
What is a floating point number?
A floating point number is a decimal number that’s decimal point can float up and down the binary string to help represent more numbers.
What does a floating point number consist of?
It has a mantissa and the exponent.
E.g
450 000 000 000 = 4.5×10^11
4.5 is the mantissa
And 11 is the exponent meaning that the decimal moves 11 places to the right.
What is the benefits of fixed point over floating?
-The values are handled in the same way as decimal values, so any hardware made to work with integers can work with this.
- The absolute error will be the same this means that precision is retained.
-It is suited to applications where speed is more important
- It is suited to appliances that need absolute level of precision
What are the benefits of floating point over fixed point?
A much wider range of numbers can be produced with the same number of bits
Consequently floating point lends itself to applications where a wide range of values may need to be represented.