What you'll learn
This revision guide covers all programming concepts tested in the CXC CSEC Information Technology examination. You will learn how to design algorithms, interpret and write pseudocode, construct flowcharts, and understand fundamental programming structures including sequence, selection, and iteration.
Key terms and definitions
Algorithm — A step-by-step procedure or set of rules designed to solve a specific problem or accomplish a particular task.
Pseudocode — A plain-language description of programming logic that uses structured notation without strict syntax rules, allowing programmers to plan code before implementation.
Flowchart — A visual diagram representing the flow of control in an algorithm using standardized symbols connected by arrows to show the sequence of operations.
Variable — A named storage location in computer memory that holds data which can change during program execution.
Iteration — The repeated execution of a set of instructions, also known as looping, controlled by a condition or counter.
Selection — A programming structure that allows a program to choose between different paths of execution based on whether a condition is true or false.
Debugging — The systematic process of identifying, analyzing, and removing errors (bugs) from program code.
Data type — The classification of data that determines what values can be stored and what operations can be performed (e.g., integer, string, real, boolean).
Core concepts
Algorithm design and representation
An algorithm must be precise, unambiguous, and finite. Every algorithm should have clearly defined inputs, processing steps, and outputs. When designing algorithms, you must consider:
Problem analysis: Break down the problem into smaller, manageable components. For example, calculating VAT on items sold in a Caribbean supermarket requires: reading the item price, multiplying by the VAT rate (typically 15% in many Caribbean territories), and adding to the original price.
Algorithm representation methods:
- Written instructions (narrative form)
- Pseudocode (structured English)
- Flowcharts (visual diagrams)
The choice of representation depends on the complexity of the problem and the audience. Flowcharts work well for visual learners and for showing branching logic, while pseudocode is more compact and closer to actual programming code.
Pseudocode conventions
Pseudocode uses standardized keywords and structures that closely resemble actual programming languages. The CSEC examination expects specific conventions:
Common keywords:
STARTandEND— mark the beginning and end of an algorithmINPUTorREAD— accept data from the userOUTPUTorPRINTorDISPLAY— show results to the userIF...THEN...ELSE...ENDIF— selection structuresWHILE...ENDWHILE— conditional loopsFOR...ENDFOR— counting loopsREPEAT...UNTIL— post-test loops
Assignment statements use the equals sign (=) or an arrow (←). For example:
total = price * quantity
average ← sum / count
Example: Algorithm to calculate electricity bill for a Caribbean household:
START
INPUT customerName
INPUT unitsConsumed
IF unitsConsumed <= 100 THEN
charge = unitsConsumed * 0.25
ELSE
charge = (100 * 0.25) + ((unitsConsumed - 100) * 0.35)
ENDIF
OUTPUT customerName, charge
END
Flowchart symbols and construction
Flowcharts use standardized symbols recognized internationally:
Terminal (oval/rounded rectangle): Indicates START or END of the algorithm
Process (rectangle): Represents calculations or operations (e.g., total = price + tax)
Input/Output (parallelogram): Shows data entry or display operations
Decision (diamond): Contains a question with Yes/No or True/False branches
Flow lines (arrows): Connect symbols and show direction of flow
Connector (circle): Links different parts of large flowcharts
Key construction rules:
- Flow should generally move from top to bottom and left to right
- Each symbol should contain clear, concise text
- Decision diamonds must have exactly two exit paths, clearly labeled
- All paths must eventually lead to END
- Avoid crossing lines where possible
When drawing a flowchart to calculate bonuses for sales staff at a Caribbean retail store, you would use a decision diamond to check if sales exceeded the target, then branch to different process boxes for calculating standard pay versus pay with bonus.
Programming structures
All programs are built using three fundamental control structures:
Sequence: Instructions executed in order, one after another. This is the default flow.
INPUT radius
area = 3.14 * radius * radius
OUTPUT area
Selection (branching): The program chooses between alternative paths based on conditions.
Simple IF:
IF temperature > 30 THEN
OUTPUT "Heat advisory for outdoor workers"
ENDIF
IF-ELSE:
IF examScore >= 50 THEN
OUTPUT "Pass"
ELSE
OUTPUT "Fail"
ENDIF
Nested IF:
IF examScore >= 70 THEN
grade = "Distinction"
ELSE
IF examScore >= 50 THEN
grade = "Pass"
ELSE
grade = "Fail"
ENDIF
ENDIF
Iteration (repetition): Instructions repeated multiple times.
FOR loop (known number of repetitions):
FOR counter = 1 TO 10
OUTPUT counter
ENDFOR
Use FOR loops when processing a fixed number of items, such as calculating total rainfall for 12 months across Caribbean territories.
WHILE loop (pre-test condition):
total = 0
INPUT value
WHILE value <> -1
total = total + value
INPUT value
ENDWHILE
The WHILE loop tests the condition before executing the body. If the condition is initially false, the body never executes.
REPEAT-UNTIL loop (post-test condition):
REPEAT
INPUT password
UNTIL password = "CSEC2024"
The REPEAT-UNTIL loop always executes at least once because the condition is tested after the body.
Variables and data types
Variables store data that programs manipulate. Each variable has:
- A unique identifier (name)
- A data type
- A value
Naming conventions:
- Must begin with a letter
- Can contain letters, numbers, and underscores
- Should be descriptive (e.g., studentName, not x)
- Case-sensitive in most languages
- Cannot use reserved words (e.g., IF, WHILE)
Common data types tested at CSEC level:
Integer: Whole numbers without decimal points (e.g., 25, -10, 0). Use for counting items like mangoes in a crate or students in a class.
Real/Float: Numbers with decimal points (e.g., 19.99, -3.14, 0.5). Use for measurements like temperature in Celsius or prices in dollars.
String: Text enclosed in quotation marks (e.g., "Kingston", "Port of Spain"). Use for names, addresses, or any text data.
Boolean: Logical values of TRUE or FALSE. Use for yes/no conditions like whether a student passed or failed.
Example of variable usage:
START
DECLARE firstName AS STRING
DECLARE age AS INTEGER
DECLARE height AS REAL
DECLARE isStudent AS BOOLEAN
INPUT firstName
INPUT age
INPUT height
isStudent = TRUE
OUTPUT firstName, age, height, isStudent
END
Trace tables and dry runs
A trace table tracks variable values as an algorithm executes, helping you verify correctness without running actual code. This process is called a dry run.
To create a trace table:
- List all variables as column headings
- Add columns for inputs and outputs
- Step through the algorithm line by line
- Record each value change in the appropriate row
Example: Trace the algorithm that finds the largest of three numbers.
START
INPUT num1, num2, num3
largest = num1
IF num2 > largest THEN
largest = num2
ENDIF
IF num3 > largest THEN
largest = num3
ENDIF
OUTPUT largest
END
Trace table with inputs num1=45, num2=67, num3=52:
| num1 | num2 | num3 | largest | Output |
|---|---|---|---|---|
| 45 | 67 | 52 | 45 | |
| 67 | ||||
| 67 | 67 |
Trace tables are particularly useful for debugging loop structures, where values change repeatedly.
Worked examples
Example 1: Algorithm design with selection
Question: Write an algorithm in pseudocode that inputs a student's exam score and outputs the grade according to this scheme: 85-100 (Distinction), 70-84 (Credit), 50-69 (Pass), 0-49 (Fail). Include input validation to ensure scores are between 0 and 100. (8 marks)
Model answer:
START
REPEAT
INPUT score
IF score < 0 OR score > 100 THEN
OUTPUT "Invalid score. Enter value between 0 and 100."
ENDIF
UNTIL score >= 0 AND score <= 100
IF score >= 85 THEN
grade = "Distinction"
ELSE
IF score >= 70 THEN
grade = "Credit"
ELSE
IF score >= 50 THEN
grade = "Pass"
ELSE
grade = "Fail"
ENDIF
ENDIF
ENDIF
OUTPUT grade
END
Mark scheme guidance: 1 mark for START/END, 1 mark for input validation loop, 1 mark for appropriate loop structure, 1 mark for each IF condition correctly structured (4 marks total), 1 mark for output.
Example 2: Iteration with accumulation
Question: A Caribbean shipping company needs to calculate the total weight of containers loaded onto a vessel. Write an algorithm that inputs the weight of containers until the user enters 0, then outputs the total weight and the number of containers. Draw a flowchart for this algorithm. (10 marks)
Pseudocode solution:
START
totalWeight = 0
containerCount = 0
INPUT weight
WHILE weight <> 0
totalWeight = totalWeight + weight
containerCount = containerCount + 1
INPUT weight
ENDWHILE
OUTPUT "Total weight: ", totalWeight
OUTPUT "Number of containers: ", containerCount
END
Flowchart solution: Would include START oval, process boxes for initialization (totalWeight=0, containerCount=0), input parallelogram for weight, decision diamond for "weight<>0?", process box for accumulation, connector back to input, output parallelograms, END oval.
Mark scheme guidance: Pseudocode (5 marks): 1 for initialization, 1 for appropriate loop structure, 1 for accumulation logic, 1 for terminating condition, 1 for output. Flowchart (5 marks): 1 for correct symbols, 1 for proper flow, 1 for decision diamond, 1 for loop structure, 1 for complete solution.
Example 3: Trace table completion
Question: Complete the trace table for this algorithm with inputs: 5, 8, 3, 10, -1. (5 marks)
START
count = 0
sum = 0
INPUT num
WHILE num <> -1
sum = sum + num
count = count + 1
INPUT num
ENDWHILE
average = sum / count
OUTPUT average
END
Model answer:
| num | count | sum | average | Output |
|---|---|---|---|---|
| 5 | 0 | 0 | ||
| 5 | 1 | 5 | ||
| 8 | 2 | 13 | ||
| 3 | 3 | 16 | ||
| 10 | 4 | 26 | ||
| -1 | 4 | 26 | 6.5 | 6.5 |
Mark scheme guidance: 1 mark for correct count values, 1 mark for correct sum values, 1 mark for loop termination at -1, 1 mark for correct average calculation, 1 mark for correct output value.
Common mistakes and how to avoid them
Confusing assignment with comparison: Use = for assignment (x = 5) and = or == for comparison in conditions (IF x = 5 THEN). Read the context carefully.
Infinite loops: Always ensure loop conditions can eventually become false. If using WHILE temperature > 25, there must be a statement inside the loop that can change temperature.
Off-by-one errors in FOR loops: FOR counter = 1 TO 10 executes 10 times, not 11. The loop includes both the start and end values.
Mismatching IF-ENDIF pairs: Every IF must have a corresponding ENDIF. Nested IFs require multiple ENDIFs. Indent your pseudocode properly to track pairs.
Incorrect flowchart symbols: Don't use rectangles for decisions or diamonds for calculations. Memorize the standard symbols and their specific purposes.
Forgetting to initialize accumulators: Before using totalSales = totalSales + sale, you must first set totalSales = 0. Otherwise, the variable contains an undefined value.
Exam technique for "Programming Concepts"
Command word precision: "State" requires a brief answer without explanation. "Describe" needs characteristics or features. "Write an algorithm" requires complete pseudocode with START/END. "Trace" means complete every row of the table.
Show your working for trace tables: Fill in every cell that changes, even if the value stays the same. Examiners award marks for demonstrating understanding of each step.
Use proper pseudocode conventions: Stick to keywords recognized at CSEC level (INPUT, OUTPUT, IF-THEN-ELSE-ENDIF, WHILE-ENDWHILE, FOR-TO-ENDFOR, REPEAT-UNTIL). Don't mix languages or invent syntax.
Draw flowcharts with a ruler: Neat, clear diagrams earn marks. Use the correct symbols, label decision branches clearly (Yes/No or True/False), and ensure all paths lead to END.
Quick revision summary
Programming concepts form the foundation of computational thinking. Master the three control structures (sequence, selection, iteration) and their representation in both pseudocode and flowcharts. Remember that algorithms must be precise and unambiguous. Practice trace tables to verify algorithm correctness. Know your data types and variable naming rules. When answering exam questions, use standard CSEC pseudocode conventions, draw flowcharts with proper symbols, and always show systematic working. Regular practice with past papers will build confidence in algorithm design and analysis.