Bits and Bytes CS Thinking Example 2

Follow the full solution, then compare it with the other examples linked below.

Example 2

medium
Convert between storage units: (a) How many bytes in 2 kilobytes? (b) A file is 3,145,728 bytes โ€” how many megabytes is that? (c) How many bits in 1 byte?

Solution

  1. 1
    Step 1: 1 byte = 8 bits. 1 kilobyte (KB) = 1024 bytes. So 2 KB = 2 ร— 1024 = 2048 bytes.
  2. 2
    Step 2: 1 megabyte (MB) = 1024 ร— 1024 = 1,048,576 bytes. 3,145,728 รท 1,048,576 = 3 MB.
  3. 3
    Step 3: 1 byte = 8 bits. The hierarchy: bit โ†’ byte (8 bits) โ†’ KB (1024 bytes) โ†’ MB (1024 KB) โ†’ GB (1024 MB).

Answer

(a) 2048 bytes, (b) 3 MB, (c) 8 bits.
Storage units follow a hierarchy based on powers of 1024 (binary) or 1000 (decimal). Understanding these conversions is essential for estimating file sizes, memory usage, and storage capacity.

About Bits and Bytes

A bit is a single binary digit (0 or 1), the smallest unit of digital data. A byte is a group of 8 bits that can represent 256 different values (0 to 255), enough to encode one text character. All digital storage and communication is measured in bits and bytes.

Learn more about Bits and Bytes โ†’

More Bits and Bytes Examples