Converting to a larger unit

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Converting to a larger unit

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. To convert bytes to KiB, what do you do?
A Divide by 1024
B Multiply by 1024
2. Which is the correct conversion of 2048 bytes to KiB?
A 2048 ÷ 1024 = 2 KiB
B 2048 × 1024 = 2 097 152 KiB
3. Convert 5 MiB to GiB. Which method is right?
A Multiply 5 by 1024
B Divide 5 by 1024
4. When you convert to a larger unit, the number you get is usually...
A Smaller than the number you started with
B Bigger than the number you started with
5. Convert 3072 KiB to MiB. Which answer is correct?
A 3 145 728 MiB
B 3 MiB

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1kib = bytes / 1024 AMultiplies instead of dividing. Going to a larger unit needs division by 1024, so the answer would be far too big.
2gib = mib / 1024 B1536 / 1024 = 1.5
3To go from KiB to MiB (the next larger unit), divide by 1024 CDivides by 1000 instead of 1024. Storage units in this course use 1024 between each step.
4The answer may not be a whole number, e.g. 1536 bytes is 1.5 KiB DConverts a size in bytes to kibibytes by dividing by 1024
5kib = bytes * 1024 EConverts a size in mebibytes to gibibytes by dividing by 1024
6mib = kib / 1000 Fmib = kib / 1024

Definitions

divide by 1024

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
kib = bytes / ____
2.
mib = kib _ 1024
3.
gib = ___ / 1024
4.
bytes = 1536 kib = bytes / 1024 print(___)
5.
mib = 3584 gib = mib / ____ print(gib)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A bytes = 3072
B kib = bytes / 1024
C print("Size in KiB:")
D print(bytes)
Question 2
A kib = 2048
B label = "MiB"
C mib = kib * 1024
D print(mib, label)
Question 3
A mib = 4096
B unit = "GiB"
C gib = mib / 1000
D print(gib, unit)
Question 4
A def to_kib b:
B return b / 1024
C print(to_kib(2048))
Question 5
A mib = 3072
B gib = mib * 1024
C print(gib)

Answer Key

Converting to a larger unit
Section A: Quick Questions
Q1
A — Divide by 1024
Q2
A — 2048 ÷ 1024 = 2 KiB
Q3
B — Divide 5 by 1024
Q4
A — Smaller than the number you started with
Q5
B — 3 MiB
Section B: Match the Pairs
Q1
kib = bytes / 1024 → Converts a size in bytes to kibibytes by dividing by 1024
Q2
gib = mib / 1024 → Converts a size in mebibytes to gibibytes by dividing by 1024
Q3
To go from KiB to MiB (the next larger unit), divide by 1024 → mib = kib / 1024
Q4
The answer may not be a whole number, e.g. 1536 bytes is 1.5 KiB → 1536 / 1024 = 1.5
Q5
kib = bytes * 1024 → Multiplies instead of dividing. Going to a larger unit needs division by 1024, so the answer would be far too big.
Q6
mib = kib / 1000 → Divides by 1000 instead of 1024. Storage units in this course use 1024 between each step.
Section C: Definitions
Q1
divide by 1024 — To convert to the next larger unit (bytes to KiB, KiB to MiB, MiB to GiB), divide the size by 1024. The answer may not be a whole number.
Section D: Fill in the Blanks
Q1
kib = bytes / 1024
Q2
mib = kib / 1024
Q3
gib = mib / 1024
Q4
bytes = 1536 kib = bytes / 1024 print(kib)
Q5
mib = 3584 gib = mib / 1024 print(gib)
Section E: Spot the Error
Q1
D — This line should print the converted size, kib (3.0 KiB). Printing bytes just shows the original number of bytes, so the conversion is never shown. It should be print(kib).
Q2
C — Going to a larger unit makes the number smaller, so you divide by 1024. Multiplying gives a far bigger number. It should be mib = kib / 1024.
Q3
C — Storage units step up in 1024s, not 1000s. MiB to GiB means dividing by 1024, so it should be gib = mib / 1024.
Q4
A — A function definition needs brackets around the parameter. It should be def to_kib(b): with the colon at the end.
Q5
B — MiB to GiB moves up to a larger unit, so you divide by 1024 instead of multiplying. 3072 MiB is 3 GiB. It should be gib = mib / 1024.