Practice Bits and Bytes in CS Thinking

Use these practice problems to test your method after reviewing the concept explanation and worked examples.

Quick Recap

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.

A bit is the smallest piece of data. A byte is enough to store one character.

Showing a random 20 of 50 problems.

Example 1

hard
How many bytes are in 2 GiB?

Example 2

medium
How many bytes are needed to store the text "COMPUTE" in ASCII (one byte per character)?

Example 3

medium
You need a unique code for each of 500 items. How many bits and how many whole bytes are required?

Example 4

easy
How many different values can 2 bits represent?

Example 5

easy
What is the smallest unit of digital data?

Example 6

medium
An image is 800 ร— 600 pixels. Each pixel uses 24 bits (8 bits each for red, green, blue). What is the uncompressed file size in megabytes?

Example 7

medium
A value needs 12 bits. How many whole bytes are required to store it?

Example 8

easy
How many values can 4 bits represent?

Example 9

medium
How many bits does a single ASCII character require?

Example 10

easy
How many bytes are in 16 bits?

Example 11

easy
A file is `8 bits`. How many bytes is that?

Example 12

challenge
To address every byte in 1 MiB (2^20 bytes) of memory uniquely, how many address bits are required?

Example 13

medium
Adding one bit to a value's width changes the number of representable values how?

Example 14

easy
How many values can 6 bits represent?

Example 15

challenge
A counter is 8 bits and currently holds 255. It is incremented by 1. What value does it hold (assuming unsigned wraparound)?

Example 16

medium
A `200 Mb/s` connection. How many megabytes per second is that (approx, using 8 bits per byte)?

Example 17

medium
How many bytes are needed to store the text "HELLO" in ASCII (one byte per character)?

Example 18

medium
Removing one bit from a value's width changes the number of representable values how?

Example 19

medium
A pixel uses 2 bytes (16 bits) for color. How many distinct colors can it represent?

Example 20

hard
You're storing 70,000 unique IDs. What is the minimum number of WHOLE BYTES per ID?