← IGCSE Computer Science Paper 1

Disk defragmentation utility

A utility that rearranges the scattered pieces of files on a hard disk drive so each file is stored together, which speeds up reading. It is not needed for SSDs.

Understanding Disk defragmentation utility in IGCSE Computer Science Paper 1

What it does: The example shows file A and file B scattered and mixed together before, then each file in a single block after defragmenting. SSDs read any location equally quickly, so there is no speed benefit and defragmenting is skipped. Fragmented means the file is split into pieces stored in different locations on the disk. Compression is a different utility. An HDD has moving parts, so scattered pieces slow it down. An SSD has no moving parts, so it does not need defragmenting. A defragmenter helps maintain the computer, so it is utility software, which is a kind of system software. Contiguous means the blocks touch each other, one after another, on the disk.

Common mistakes: An antivirus scans for malware and does not join file pieces together. A hard disk drive needs the defragmenter, so the line should be RUN defragmenter. The count must start at the number of scattered pieces, such as 12. Starting at 0 means the WHILE condition is false and no pieces are ever joined.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 356–372) and word search (Modules 356–389).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What does a defragmenter do to the pieces of a file on a hard disk drive?
Deletes the pieces it does not needJoins them together in one contiguous block
Matches
Defragmenter: deletes old files to free up space on the disk
↓
A defragmenter does not delete files. It only rearranges the pieces of files so each file is stored together.
Applying
Meanings
Term
defragmenter
Meaning
A utility that rearranges the scattered pieces of files on a hard disk drive so each file is stored together, which speeds up reading. It is not needed for SSDs.
Practice
IF driveType = "HDD" THEN
Testing
Gaps
IF drive = "" THEN
Check Answer
Spots
1IF drive_type = "HDD" THEN
2 RUN antivirus

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Ostrich' badge — Full Sprint, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What does a defragmenter do to the pieces of a file on a hard disk drive?
A. Joins them together in one contiguous block ✓
B. Deletes the pieces it does not need
A defragmenter rearranges the scattered pieces of each file so they are stored next to each other (contiguous).
2. A file is fragmented. What does this mean?
A. Its pieces are scattered in different places on the disk ✓
B. Its data has been compressed to take up less space
Fragmented means the file is split into pieces stored in different locations on the disk. Compression is a different utility.
3. Why does defragmenting a hard disk drive make file access faster?
A. The read head does not have to jump around to find each piece ✓
B. The files become smaller so they load quicker
Defragmenting does not change file size. Pieces stored together mean the read head moves less, so reading is faster.
4. Which storage device benefits from defragmentation?
A. Solid-state drive (SSD)
B. Hard disk drive (HDD) ✓
An HDD has moving parts, so scattered pieces slow it down. An SSD has no moving parts, so it does not need defragmenting.
5. Why is a defragmenter not needed for an SSD?
A. An SSD cannot store fragmented files at all
B. An SSD has no moving parts, so scattered data is read just as fast ✓
SSDs can store fragmented files, but they access any location equally quickly, so defragmenting gives no speed benefit.

Match the Pairs

defragmenter → A utility that rearranges the scattered pieces of files on a hard disk drive so each file is stored together, which speeds up reading
fragmented file → A file whose pieces are stored in different places on the disk instead of next to each other
A defragmenter joins the pieces of each file into one contiguous block, so the file is stored together → Before: A1 B1 A2 B2 A3 -> After: A1 A2 A3 B1 B2
Defragmenting is not needed for solid-state storage, because an SSD has no moving parts to jump around the disk → if driveType == "SSD": skip defragmentation
Defragmenter: deletes old files to free up space on the disk → A defragmenter does not delete files. It only rearranges the pieces of files so each file is stored together.
Run the defragmenter on an SSD to make it faster → Defragmenting is for hard disk drives, not SSDs. An SSD has no moving parts, so it gains no speed from this.

Key Term

defragmenter
A utility that rearranges the scattered pieces of files on a hard disk drive so each file is stored together, which speeds up reading. It is not needed for SSDs.

Fill in the Blanks

1. IF drive = "HDD" THEN defragment(drive) ENDIF
Hint: Type the abbreviation for the type of drive that benefits from defragmenting.
2. IF drive = "SSD" THEN needsDefrag ← FALSE ENDIF
Hint: Type the Boolean value showing that solid-state storage does not need defragmenting.
3. IF pieces > 1 THEN fragmented ← TRUE ENDIF
Hint: Type the comparison operator that checks the file is split into more than one piece.
4. drive ← "HDD" defragment(drive) OUTPUT "Files are now contiguous"
Hint: Type the name of the procedure that rearranges the scattered pieces of files.
5. WHILE pieces > 1 pieces ← pieces - 1 ENDWHILE
Hint: Type the arithmetic operator that lowers the piece count as pieces are joined together.

Spot the Error

Question 1
A IF drive_type = "HDD" THEN
B RUN antivirus
C ELSE
D OUTPUT "Not needed"
E ENDIF
Line B — An antivirus scans for malware and does not join file pieces together. A hard disk drive needs the defragmenter, so the line should be RUN defragmenter.
Question 2
A fragments ← 0
B WHILE fragments > 1
C JOIN two fragments
D fragments ← fragments - 1
E ENDWHILE
Line A — The count must start at the number of scattered pieces, such as 12. Starting at 0 means the WHILE condition is false and no pieces are ever joined.
Question 3
A INPUT drive_type
B IF drive_type = "SSD" THEN
C OUTPUT "Defrag now"
D ELSE
E RUN defragmenter
F ENDIF
Line C — Solid-state drives have no moving parts, so scattered files do not slow them down. For an SSD the message should say that defragmenting is not needed.
Question 4
A FOR each file on the disk
B IF pieces < 1 THEN
C JOIN pieces together
D ENDIF
E NEXT file
Line B — A file is fragmented when it is stored in more than one piece. The test should be pieces > 1, so only fragmented files are joined together.
Question 5
A fragmented ← TRUE
B WHILE fragmented = TRUE
C JOIN file pieces together
D fragmented ← TRUE
E ENDWHILE
Line D — Once the pieces are joined the file is no longer fragmented, so the flag must be set to FALSE. Setting it to TRUE again makes the loop run forever.

Student with a class code? Join your class →