Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Data as the computer sees it 1 Number systems Data storage Glossary 2 Because of their electronics, computers work with only two states – on or off, that is a binary or base 2 number system 3 Base 10 (Decimal) 2358 Base 2 (Binary) 10101012 Base 16 (Hexadecimal) A2CD3E16 4 Decimal number (base 10): 4192.304 Number 4 1 9 2 Placeholde r column 3 2 1 Place value/ Written as base 103 102 1000 100 Place value Expanded notation . 3 0 4 0 -1 -2 -3 101 100 10-1 10-2 10-3 10 1 1/10 =0,1 1/100 1/1000 =0,01 =0,001 4192.304 =4 X 103+1 X 102+9 X 101+2X100+3X10-1+0X10-2+4X10-3 =4000+100+90+2+0.3+0+0.004 =4192.304 5 Binary number (base 2): 1101.101 Example of number 1 1 0 1 Placeholder column 3 2 1 Place value written as 23 22 4 . 1 0 1 0 -1 -2 -3 21 20 2-1 2-2 2-3 2 1 ½ ¼ 1/8 =0.5 =0.25 =0.125 Base Placeholder column Place value (as 8 a decimal value) 6 Hexadecimal numbers (base 16) Example of number 1 A 5 F Placeholder column 3 2 1 Place value written as 163 162 4096 256 . 3 D 0 -1 -2 161 160 16-1 16-2 16 1 1/16 1/256 Base Placeholder column Place value (as a decimal value) =0.0625 =0.00390625 7 Engineers discovered that it was easy, from a ‘physical’, engineering point of view, to have just two states – on or off. This could easily be represented by the presence or absence of current flow. Hence at the lowest level, data is represented in binary, to make it easier to design and build hardware. 8 Convert binary numbers to decimal numbers 10012= (1 x 23) + (0 x 22) + (0 x 21) + (1 x 20) = (1 x 8) + (0 x 4) + (0 x 2) + (1 x 1) =8+1 =9 9 Convert the following binary numbers to decimal numbers, showing all your calculations. 10 Convert hexadecimal to decimal number 2F316= (2 x 162) + (F x 161) + (3 x 160) = (2 x 256) + (15 x 16) + (3 x 1) = 512 + 240 + 3 = 755 11 Convert the following hexadecimal numbers to decimal, showing all your calculations. 12 This is good old primary school division with the remainder! 13 Convert the following decimal numbers to binary numbers. 14 634 ÷ 16 = 39 remainder 10 39 ÷ 16 = 2 remainder 7 2 ÷ 16 = 0 remainder 2 answer is 27A16 (10 = A) 15 Write the following decimal numbers in hexadecimal notation. 16 Each of these data types is allocated a fixed number of what is termed bytes. Each byte (a number in binary format e.g. 101100112) in turn, consists of 8 binary digits or bits. Here is an example of data stored in 4 bytes of 8 bits each, i.e. 32 bits. 17 Common data types: Integer or whole number Real or decimal or floating point String or text Each data type is allocated a fixed amount of space (bytes) to store its associated data There is therefore a limit on the data that can be stored –more bytes larger the range and fewer bytes - smaller the range. 18 Delphi Data type Bytes allocated Java Range Data type Bytes allocated Range byte 1 0..255 byte 1 -128 to127 Short int 2 -32768 .. 32767 short 2 -32768 .. 32767 -2147483648.. int 4 -2147483648.. integer 4 2147483647 int64 8 -9223372036854 775808.. 922337203685477 5807 2147483647 long 8 -92233720368 54775808.. 9223372036854 775807 19 A text or string variable that could store a maximum of 5 characters and was assigned the value ‘Addendum’ to the variable. A Some d d e n of the text can be ‘lost’. We refer to the situation where an integer number is ‘misrepresented’ due to an insufficient number of bits being available, as overflow. 20 Each program/programming language uses different numbers of bytes to store numbers Decimal or real numbers are normally stored in two parts, namely a ‘number’ part and an ‘exponent’ part e.g. 3.1415462973812 x 1012 Obviously, a loss of accuracy in the exponent part would be critical ! A loss of accuracy in the number part would lead to a loss of accuracy in the number of decimals 21 Coding schemes The ASCII system was the original standard which assigned numeric values to letters, digits, punctuation marks, and other characters 22 Pictures and sound clips Picture is a collection of thousands of dots, each of which can be modelled by representing its position and colour etc.,then we can digitise any picture or video Music too can be modelled by representing the data as numerical values describing volume, pitch and frequency 23 Know the basics 24 Apply your knowledge 25 Think and research 26 ASCII Binary Bit Byte Coding scheme Decimal Hexadecimal Octal Overflow Primitive data type Truncation 27