Library routines
A ready-made subroutine supplied with the language that you can call without writing it, such as ROUND, RANDOM or LENGTH. It saves time and avoids errors.
Understanding Library routines in IGCSE Computer Science Paper 2
What it does: The library routine ROUND is called inside an expression and its returned value is stored in Total, just like a user-written function. RANDOM is a ready-made routine that returns a number between 0 and 1. Using it saves time and avoids errors compared with writing your own. Library routines are written and tested already, so programmers save time and are less likely to introduce errors. MOD returns the remainder after division, so it needs a number on each side. Without the second value the expression is incomplete.
Common mistakes: LENGTH is a library routine, so it is called like a function with the value in brackets. It should be Size ← LENGTH(Word). The library routine MOD needs two values separated by a comma. It should be Rem ← MOD(17, 5).
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 429–438) and word search (Modules 419–438).
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
library routineFill in the Blanks
Spot the Error
Student with a class code? Join your class →