Full Transcript

# Chapter 3: Data Representation ## 3.1 Introduction ### Data and Computers * **Data**: Facts and figures which relay information. * **Computers**: Electronic devices that store and process data. Computers work with data in a coded form suitable for electronic manipulation. ### Data Represe...

# Chapter 3: Data Representation ## 3.1 Introduction ### Data and Computers * **Data**: Facts and figures which relay information. * **Computers**: Electronic devices that store and process data. Computers work with data in a coded form suitable for electronic manipulation. ### Data Representation * **Data representation**: The form in which data is stored, processed, and transmitted. This chapter explores various data representation methods within computers. ## 3.2 Number Systems ### Decimal Number System * Base-10 system. * Uses digits 0-9. * Each digit's position represents a power of 10. $528 = (5 \times 10^2) + (2 \times 10^1) + (8 \times 10^0)$ ### Binary Number System * Base-2 system. * Uses digits 0 and 1 (bits). * Each bit's position represents a power of 2. $1011 = (1 \times 2^3) + (0 \times 2^2) + (1 \times 2^1) + (1 \times 2^0) = 8 + 0 + 2 + 1 = 11$ ### Octal Number System * Base-8 system. * Uses digits 0-7. * Each digit's position represents a power of 8. $237 = (2 \times 8^2) + (3 \times 8^1) + (7 \times 8^0) = 128 + 24 + 7 = 159$ ### Hexadecimal Number System * Base-16 system. * Uses digits 0-9 and letters A-F (A=10, B=11, C=12, D=13, E=14, F=15). * Each digit's position represents a power of 16. $3B = (3 \times 16^1) + (11 \times 16^0) = 48 + 11 = 59$ ### Converting Between Number Systems 1. **Binary to Decimal**: Use the formula illustrated above. 2. **Decimal to Binary**: Repeatedly divide by 2, noting remainders. 3. **Binary to Hexadecimal**: Group bits into sets of 4, then convert. 4. **Hexadecimal to Binary**: Convert each hexadecimal digit to 4 bits. ## 3.3 Representing Characters ### Character Codes * **Character code**: Numerical representation of characters. * **ASCII**: American Standard Code for Information Interchange. (7-bit) * **Extended ASCII**: 8-bit version of ASCII. * **Unicode**: A more comprehensive character set (16-bit or more). ### ASCII * Represents English characters, numbers, and symbols. * Limited to 128 characters. ### Unicode * Supports characters from various languages. * UTF-8, UTF-16, and UTF-32 are common encodings. ## 3.4 Representing Images ### Raster Graphics * Images composed of pixels. * Examples: BMP, JPEG, PNG, GIF. * Resolution: Number of pixels in an image (e.g., 1920x1080). ### Vector Graphics * Images composed of geometric shapes. * Examples: SVG, AI, EPS. * Scalable without losing quality. ## 3.5 Representing Sound ### Analogue vs. Digital * **Analogue**: Continuous representation of sound waves. * **Digital**: Discrete representation of sound waves. ### Sampling * The process of converting analogue sound to digital. * Sampling rate: Number of samples taken per second (e.g., 44.1 kHz). * Bit depth: Number of bits used to represent each sample (e.g., 16-bit). ### Audio File Formats * Examples: WAV, MP3, AAC, FLAC. * Compression: Techniques to reduce file size. ## 3.6 Representing Video ### Video Basics * Sequence of still images (frames) displayed rapidly. * Frame rate: Number of frames displayed per second (fps). ### Video Compression * Techniques to reduce video file size. * Examples: H.264, MPEG-4, VP9. ### Video File Formats * Examples: MP4, AVI, MOV, MKV. ## 3.7 Data Compression ### Lossy Compression * Some data is lost during compression. * Suitable for images, audio, and video where minor loss is acceptable. * Examples: JPEG, MP3. ### Lossless Compression * No data is lost during compression. * Suitable for text and data files where no loss is acceptable. * Examples: ZIP, PNG. ## 3.8 Data Encryption ### Encryption Basics * Process of converting data into a form that is unreadable without a decryption key. * **Plaintext**: Original data. * **Ciphertext**: Encrypted data. ### Encryption Methods * **Symmetric encryption**: Uses the same key for encryption and decryption. * **Asymmetric encryption**: Uses different keys for encryption and decryption (public and private keys). ### Example Encryption Algorithms * **AES**: Advanced Encryption Standard (symmetric). * **RSA**: Rivest-Shamir-Adleman (asymmetric).

Use Quizgecko on...
Browser
Browser