1.4.1 Data Types
No description yet. This curated deck is ready for daily study.
Card preview (13)
1.4.1 A) What is the need for data types
Data stores in binary stored in right data type so right operations can be preformed
5 data types with brief expiation
Integer - whole number real / float - decimal point number character- single symbol string - collection of character Boolean - True or False
1.4.1 B) Whats a single binary digit called 8 bits 4 bits
bit 1 byte 1 nibble
Bases for binary, decimal , hexadecimal
2 , 10 ,16
1.4.1 C) What is sign and magnitude
Leading 1 = negative Leading 0 = positive Example binary 173 10101101 sign and magnitude +173 010101101 sign and magnitude -173 110101101
Twos complement
flip +1
1.4.1 D) adding and subtracting
0 + 0 = 0 1 + 0 = 1 1 + 1 = 10 1 + 1 + 1 = 11 1 = 2 on coluemm to the right
1.4.1 E/F) Hexadecimal conversion
Hex 0-9 = 0-9 10-15 = A-F base 16 split into digit convert hex into dec convert dec > binary combine nibbles
1.4.1 g) normalisation
must start with 10 or 01 (shift the exponents and mantissa )
floating point
exponent use two complement move decimal point + right - left decimal starts between 1st and 2nd digit in mantissa
(h) Floating point arithmetic, positive and negative numbers, addition and subtraction.
Too add fp exponent must be the same must normalize too sub make exponent same (mantissa twos complement > add > normalise
(i) Bitwise manipulation and masks: shifts, combining with AND, OR, and XOR.
Shift right n =2^n increase Shift left n =-2^n increase masks can be applied to binary number combined with logic gated AND 1 + 1 = 1 , 0 + 1 = 0 , 0 + 0 = 0 OR 1 + 1 = 1 , 0 + 1 = 1 , 0 + 0 = 0 XOR 1 + 1 = 0 , 1+0 = 1 , 0 + 0 = 0
j) How character sets (ASCII and UNICODE) are used to represent text
ASCII 7 bits 128 diff char A-Z 65-90 , a-z 97-122 ASCII cant represnt diff languages unicode solved this problem using varying number of bits allowing over 1m diff char