Ez Computerहिन्दीOpen app

Data Representation and Computer Codes

Preview Part C: Data and Logic · Chapter 12 · 13 min read · 54 practice questions

After this chapter you will be able to

  • explain how text, numbers, images and sound are stored as bits
  • describe BCD, Excess-3 and Gray codes with examples
  • compare ASCII, EBCDIC and Unicode
  • explain parity bits and simple error detection
Data Codes Everything is bits Numbers, text, media Sampling: CD = 44.1 kHz Lossless vs lossy Numeric codes BCD: 4 bits per digit Excess-3: digit + 3 Gray: one bit changes Character codes ASCII: 7 bits, 128 EBCDIC: 8 bits, IBM Unicode: all scripts Units Nibble = 4 bits Byte = 8 bits Error detection Parity detects errors Hamming can correct Floating point IEEE 754 standard Single 32 · Double 64 Image formats GIF: 256 colours PNG: lossless, 24-bit
Chapter 12 at a glance Recall: BCD = 4 bits per digit · Gray = one bit changes · ASCII 7-bit, EBCDIC 8-bit · parity detects, Hamming corrects.

12.1 Everything Becomes Bits

Data How it is stored
Numbers Binary integers (2’s complement for negatives); floating-point for decimals (IEEE 754: sign, exponent, mantissa)
Text Each character gets a number from a character code (ASCII, Unicode)
Images A grid of pixels; each pixel stores colour bits (e.g., 24-bit RGB) — bitmap/raster; or shapes as maths — vector
Sound Sound wave is sampled thousands of times per second (e.g., 44.1 kHz for CD) and each sample stored as bits
Video A sequence of image frames (e.g., 30 frames per second) plus sound

⚡ QUICK FACT — A bitmap image becomes blocky (pixelated) when enlarged; a vector image (SVG, AI files) stays sharp at any size.

Common Image File Formats

Format Full form Colour depth Compression Note
GIF Graphics Interchange Format 8-bit, up to 256 colours from a palette Lossless (LZW) Simple graphics, logos and small animation
PNG Portable Network Graphics 24-bit true colour (about 16.7 million colours) Lossless Supports transparency (alpha channel)
JPEG Joint Photographic Experts Group 24-bit colour Lossy Photographs
BMP Bitmap Various Usually uncompressed Windows bitmap format

12.2 Units of Data

Unit Size
Bit 0 or 1
Nibble 4 bits
Byte 8 bits (one character in ASCII)
Word 16/32/64 bits (depends on the CPU)
Double word 32 bits

What the full chapter covers

The full chapter has these sections:

  1. 12.1 Everything Becomes Bits
  2. 12.2 Units of Data
  3. 12.3 Numeric Codes
  4. 12.4 Character Codes
  5. 12.5 Error Detection: Parity
  6. 12.6 Floating-Point Representation (Idea)
  7. 12.7 Two More Numeric Codes
  8. 12.8 Worked Examples
  9. 12.9 More Exam Facts
  10. Chapter Quick Revision
  11. Most Important Terms
  12. Common Confusions
  13. Rapid Recall

Sample questions from this chapter

1. Unicode encoding that always uses 4 bytes?

  1. UTF-32
  2. ISCII
  3. EBCDIC
  4. UTF-8
Show answer

Answer: A. UTF-32

UTF-32 uses a fixed 4 bytes for every character.

2. Binary of Gray code 11010011?

  1. 11010011
  2. 10011100
  3. 10111010
  4. 10011101
Show answer

Answer: D. 10011101

Gray to binary: the first bit stays; each next binary bit = previous binary bit XOR the Gray bit, giving 10011101.

3. Storage size of one ASCII character?

  1. 4 bits (1 nibble)
  2. 8 bits (1 byte)
  3. 16 bits (2 bytes)
  4. 7 bits
Show answer

Answer: B. 8 bits (1 byte)

Each ASCII character is stored in one byte (8 bits), though the standard code uses 7 bits.

4. Bits needed to code 64 items?

  1. 5
  2. 8
  3. 7
  4. 6
Show answer

Answer: D. 6

With n bits you get 2ⁿ codes; 2⁶ = 64, so 6 bits are needed.

5. Term for the number of bits in an audio sample?

  1. Bit depth
  2. Sampling rate
  3. Bit rate
  4. Frame rate
Show answer

Answer: A. Bit depth

Bit depth is the number of bits used to store each audio sample; more bits give finer detail.