Section 6 -Data types

33 flashcardsby Dsobo
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
1)Define interger
2)Define real/float
3)Define boolean
4)Define character
1)whole number such as -25, 0
2)real/float a number with a fractional part e.g. -13.5
3)Boolean variable can only take the value TRUE or FALSE
4) letter, number or special character typically represented in ASCII, such as a, A, 4,
- different in the computer from the integer 4 or the real number 4.0



2
1)What is the number base for denary
2)What is number base for Binary
3)What is number base for Hexadecimal
1) 0-9 base = 10
2)0-1 base = 2
3)0-9 and A-F base = 16



3
1)How convert binary to denary
1) left to right, each digit is worth twice as much as the previous one,
-1, 2 ,4 8,16,32,64,128
4
1)how convert denary to binary
2)What is 73 in binary
1) e.g. write a 1 under the largest heading less than 73(i.e. 64).
You now have 73 — 64 = 9 remaining, to be converted to binary. 9 = 8 + 1 so put 1 under 8 and under 1.
Fill the spaces with zeros. = binary representation
2)01001001

5
1)What are the Letters in hexadecimal in denary
A=10 D=13
B=11 E=14
C=12 F=15
6
1)How convert Binary to hexadecimal -vice versa
2)
split the binary number into groups of 4 binary digits.
Binary 0011 1010 1111 1010
Hex 3 A F 9
7
1)How convert hexadecimal to denary
2)Define byte
1) hex to binary then to denary - visa versa for denary to hex
2) group of binary digits or bits (usually eight) operated on as a unit.-One byte holds one character of text.
8
1)Why is hexadecimal used?
2)Where used?
1)easier for technicians and computer users to write or remember a hex number than a binary number.
2)Colour codes in images often use hexadecimal to represent the RGB values,
9
1)Define bit
2)What is a kibi
1)fundamental unit of information in the form of either a single 1 or 0.
2)kibi would represent 1024 bytes
10
1)What is ASCII code?
2))Cons
1)Racist-(American Standard Code for Information Interchange)
uses seven bits which form 128 different bit combos,
more than enough to cover all of the characters on a standard English-language keyboard.
2))number character is not the same as the actual number value. -noy be used for arithmetic
would use unnecessary space to store numbers.
11
1)What is unicode?
2)Pro
1)(United) different combos could therefore represent alphabets from dozens of languages
Unicode called UTF-32 was also developed to include just over a million characters, and more than enough to handle
most of the characters from all languages, including Chinese and Japanese
one character in this uses four bytes instead of two = increasing file sizes and data transmission times.

12
1)How does binary addition work
2)What if is greater thsan 255 ?
1)an addition that equals 2 or more results in a carry over to the next column.
2)overflow error occurs where a carry from the most significant bit requires a ninth bit.



13
How to tell if is positve using sign and magnitude
How tell if its negative using sign and magnitude
If the most significant/left most bit is zero = positive
if the most significant/left most bit is one = negative.
14
1)How two’s complement work
works in a similar to numbers on an analogue counter. Moving forwards one = reading of 0001 turn back one = 9999.
binary :
11111101 = -3 00000011 = 3 11111110 = -2
15
How work out range using twos complement
2)What is range of denary?
1)range that can be represented with two’s complement using n bits is given by the formula:
-(2(^n-1) to (2(^n-1) -1
2) -128 to 127 -leftmost bit indicate whether a number is negative

16
1)how Convert negative denary number to binary
1)Start by working out the positive equivalent of the number, flip all of the bits and add 1.
Positive binary :00001001 Flip the bits : 11110110
Add one: 1 = 11110111


17
1) Convert a negative two’s complement binary number to denary
1) Flip all of the bits and add 1.
Then work out the result in denary using the normal method.
18
1)How do binary subtraction
2)What does a binary point do in fixed point
3)Order of fractional parts?
1)best done by using negative two’s complement number and then adding the second number.
2)binary point is used to separate the whole place values from the fractional part on the number line
3)1/2 1/4 1/8 1/16
19
1)how Convert a denary fraction to fixed point binary
2)Disadvantages of fraction to fixed binary
1)Take value and subtract each point value from the amount until you are left with 0.
2) 2 digits after the point can only represent 0, ¼, ½, or 3/4 and nothing in between
e.g. 0.4 require an infinite number of bits to the rightThe number of fractional places = shortend number= not precise = rounding errors.
only 8 bits to store a number to 2 binary places, you would need 2 digits after the point= left with 6



20
1)Realtionship between range and accuracy with fixed point binary
1)Moving the point one to the left to improve accuracy within the fractional part only serves to half the range to just 0-31.
21
How convert floating point to denary
Write down the mantissa, 0.1011010.
Translate the exponent from binary to denary 0011 = 3.
This means that you have to move the point 3 places to the right, as the mantissa has to be multiplied by 23.
The binary number is therefore 101.1010
22
1)What if the exponent is negative
1) the decimal point must be moved left instead of right.
23
1)How Handle negative mantissas
have a 1 as the sign bit
Find 2's complement of the mantissa. is 0.1010011, so bits represent -0.1010011.
Translate exponent to denary, 0101 = 5.
Move binary point 5 places to the right to make it larger. The mantissa is -10100.11.
Translate this to binary. The answer is -20.75.
24
1)Define Normalisation
1) process of moving binary point of a floating point number to provide the maximum level of precision for a given number of bits
-achieved by ensuring that the first digit after the binary point is a significant digit.
25
How Convert from denary to normalised binary floating point
first convert the number to fixed point binary then to denary
26
how do add or subtraction with floating point
line up the points by making the exponents equal
add or subtract the mantissas
normalise the result
27
1)Why underflow occur?
2)Why overflow occur?
1)when a number is too small to be represented in the allotted number of bits.
2)when the result of a calculation is too large to be held in the number of bits allocated.
28
1)What happens in a logical shift
2)What happens when go right?
3)What happens if go left?
1)All the bits move right or left.
2) least significant bit (lsb) shifted into the carry bit, zero moves into most significant bit (msb) to occupy the vacated space
2)most significant bit (msb) moves into the carry bit and a zero moves into the lsb.
29
1)What happens in arithimetic shifts?
2)What happens if shift right?
3)What happens if shift left?
4)What happens to the sign bit?
1)takes into account the sign bit, which always remains the same
2)effect of dividing by 2.
3)Shifting left multiplies by 2.
4)The shift bypasses the sign bit, leaving the msb the same whatever the value of the other bits.


30
1)How to Multiply two numbers using arithmetic shifts
1)combination of shifts and addition, two binary numbers may be multiplied together.
Multiply 9 by 5 using shifts and addition:
9 x 1: 0000 1001 9 x 4 = 2 left shifts: 0010 0100
Add together: 0010 1101 = 45
31
1)What happens in a circular shift right?
1)circular shift right, value in the least significant bit (lsb) is moved into the carry bit, and the carry bit is moved into the most significant bit (msb)
32
1)What does 1 and 0 repressent in boolean logic ?
2)What is a NOT instruction?
3)What is AND gate ?
4)What is an OR gate?
1) 1= True and 0 =False
2) has only one input = the input is True (1) the output is False ( 0)=opposite output from input
3)AND gate =both inputs True ( 1) the output True. Otherwise output = False.
4)either the inputs is True output = True if not output = False.






33
1)What is XOR gate?
XOR gate, either, but not both, inputs is True, the output is True if not output = False.
Study all 33 cards for free