Data Types- S6 Flashcards
Give all data types
Integer, String, Float, Character, Boolean, Data
What base is Binary in
2
What are the addition rules
0+0=0
0+1=1
1+1= 0 and carry 1
1+1+1= 1 and carry 1
Explain why addition of binary numbers can be wrong?
Overflow can occur if you end up with a binary number with more bits than you can have. If the binary number is also then two’s compliment or sign and magnitude it could make the binary number seem positive or negative when its not.
What is sign and magnitude
the leftest most bit represents the sign only and the rest is the magnitude (the number). If the sign is 0 then positive, if 1 then negative.
What is 1001010 if it is represented as sign and magnitude
-10
What is two’s compliment
the leftest most bit dictates whether the number is positive or negative. If it is 1, the binary needs to be inversed.
How do you inverse a binary in twos complimet
Go along from right to left. After the first 1 is encountered invert the rest of the number.
What is Floating point?
There is an mantis and exponent.
How do you convert a binary floating point and twos compliment to denary?
First separate mantisa and exponent. Put a decimal place between the leftest and second most left numbers on the mantisa. If 1.0 flip the mantisa, if exponent starts with 1 as well then flip. If exponent is negative move point to the left, if positive mover to the right.
How would you turn denary into floating point and twos compliment
Write in binary, put a . at the right end. Move the . to the left until 0. if negative invert now. If the decimal moved to the
How would you turn denary into floating point and twos compliment
Write in binary. Move the . to the left until 0. if negative invert now. If the decimal moved to the left the exponent is +the number of points moved . If point move to the right exponent is -the number of points moved.
Why is floating point used
for a bigger range, and to hold fractions
A bigger mantisa leads to… and a bigger exponent leads to…
>mantisa= more accurate >exponent= bigger range
What is a Character Set
The list of all the character recognised by the computer and each character is represented by it’s own unique code