HCI 5. Data Representation
Uploaded by adrianwang2003 · 28 May 2024
Preview
Hwa Chong Institution H2 Computing 1 5 Data Representation Learning Outcome 5.1 Binary Representation Computers only ‘understand’ 0’s and 1’s. All the data inside a computer has to be represented by patterns of 1’s and 0’s. e.g. 0 1 0 1 1 0 1 0 represents character ‘Z’ in ASCII code 0 0 0 0 0 0 1 1 represents number 3 A bit is a binary digit. It can be a 1 or 0. A byte is taken to represent 8 bits. A word is the number of bytes that can be stored inside a memory location. e.g. A 16-bit computer memory location contents 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 a bit a byte ( 8 bits) a word ( 16 bits) 5.2 Number Systems System Base Digits Used Used by Decimal (Denary) 10 0,1,2,3,4,5,6,7,8,9 humans Binary 2 0,1 computers Octal 8 0,1,2,3,4,5,6,7 Programmers as Data Representation Represent data in binary and hexadecimal forms Write programs to perform the conversion of positive integers between different number bases: denary, binary and hexadecimal forms; and display results Data Validation Understand data validation technique: check digit
Hwa Chong Institution H2 Computing 2 Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F ‘shorthands’ for binary A number N with base r is written as N r e.g. 101 2 71 8 19A 16 6925 (Binary) (Octal) (Hex) (Decimal) Place Value: the value of any digit depends on its position in the number. e.g. Decimal number 4957 place value : 10 3 10 2 10 1 10 0 ------------------------------ 4 9 5 7 e.g. Binary number 1101 2 place value : 2 3 2 2 2 1 2 0 -------------------------- 1 1 0 1 The most significant digit (MSD) is the digit with the highest place value in the number. The least significant digit (LSD) is the digit with the lowest place value in the number. e.g. 1 0 0 1 0 2 , 4 9 7 5 10 MSD LSD MSD LSD 5.3 Conversion of a number from one base to another 5.3.1 From decimal to another base Example Convert 79 10 to binary. 2 7 9 remainder 2 3 9 ------ 1 (LSD) 2 1 9 ------ 1 2 9 ------ 1 2 4 ------ 1 2 2 ------ 0 2 1 ------ 0 stopping 0 ------ 1 (MSD) condition
Hwa Chong Institution H2 Computing 3 79 10 = 1 0 0 1 1 1 1 2 Example Convert 79 10 to hexadecimal. 16 7 9 remainder 16 4 ------ F (LSD) 0 ------ 4 (MSD) 79 10 = 4 F 16 note : F 16 is equivalent to 15 10 Method :
Content continues in the PDF.
Related notes
- VJC Chapter 21 SQLite with PythonNotes/Practices · 2025
- VJC Chapter 23 Web Applications PrinciplesNotes/Practices · 2025
- VJC Chapter 10 RecursionNotes/Practices · 2025
- VJC Chapter 20 SQLNotes/Practices · 2025
- VJC Chapter 16 Hash TableNotes/Practices · 2025
- VJC Chapter 22 NoSQLNotes/Practices · 2025

