Checking whether a file fits in the available storage
A file fits if its size is less than or equal to the free space. First convert both to the same unit, such as bytes or MiB, then compare the two numbers.
Understanding Checking whether a file fits in the available storage in IGCSE Computer Science Paper 1
What it does: 1 GiB is 1024 MiB, so 2 GiB is 2048 MiB. Both are now in MiB, and 1500 is less than 2048, so the file fits. Capacity and file size are already in MiB, so dividing 64 by 4 gives 16 images that fit. The numbers only mean something when the units match. 2 GiB = 2048 MiB, so compare 600 MiB with 2048 MiB. 1 GiB = 1024 MiB. Divide 1024 by 4 to get 256 images. 1 GiB = 1024 MiB. 1024 / 250 = 4.096, so only 4 whole files fit. A part of a file does not count.
Common mistakes: To convert GiB to MiB you multiply by 1024, not 1000. It should be driveMiB ← driveGiB * 1024, so both sizes are in MiB before comparing. A file fits when its size is less than or equal to the free space. The test should be fileMiB <= freeMiB, not >.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 69–84) and word search (Modules 59–84).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
file size <= capacityFill in the Blanks
Spot the Error
Student with a class code? Join your class →