PseudoStudio PRACTICE HUB
START SOLVING →
CAMBRIDGE IGCSE 0478 / 0984 A-LEVEL 9618 ONLINE COMPILER READY

Pseudocode Practice Questions with Answers

Solve 50+ Cambridge Computer Science pseudocode questions with step-by-step model answers. Master loops, arrays, conditionals, subroutines, and trace tables. Write your solutions and test them instantly using our free online compiler.

TOPIC 1

Variables, Arithmetic & Expressions

Practice declaring data types, arrow assignment (), constant values, and arithmetic operations.

VARIABLES & ARITHMETIC EASY • 4 MARKS

Question 1: Store Discount & Final Price Calculator

Write a pseudocode algorithm that prompts the user to enter an item price (REAL) and a discount percentage (INTEGER). Calculate the discount amount and the final discounted price, then output both values clearly formatted.

👁️ Show Model Answer & Solution Code
DECLARE ItemPrice : REAL
DECLARE DiscountPct : INTEGER
DECLARE DiscountAmt : REAL
DECLARE FinalPrice : REAL

INPUT ItemPrice
INPUT DiscountPct

DiscountAmt ← ItemPrice * (DiscountPct / 100)
FinalPrice ← ItemPrice - DiscountAmt

OUTPUT "Discount: ", DiscountAmt
OUTPUT "Final Price: ", FinalPrice
▶ Run in PseudoStudio IDE
CONSTANTS & FORMULAS EASY • 4 MARKS

Question 2: Circle Area & Circumference Calculator

Write a pseudocode algorithm that inputs the Radius (REAL) of a circle. Declare a CONSTANT PI ← 3.14159. Compute Circumference = 2 * PI * Radius and Area = PI * Radius * Radius. Output both calculated results.

👁️ Show Model Answer & Solution Code
CONSTANT PI ← 3.14159
DECLARE Radius : REAL
DECLARE Circumference : REAL
DECLARE Area : REAL

INPUT Radius
Circumference ← 2 * PI * Radius
Area ← PI * Radius * Radius

OUTPUT "Circumference: ", Circumference
OUTPUT "Area: ", Area
▶ Run in PseudoStudio IDE
ASSIGNMENT & TEMPORARY VARIABLES EASY • 3 MARKS

Question 3: Swap Two Variable Values

Write an algorithm that prompts for two integers X and Y, swaps their stored values using a temporary variable Temp, and outputs the swapped values of X and Y.

👁️ Show Model Answer & Solution Code
DECLARE X : INTEGER
DECLARE Y : INTEGER
DECLARE Temp : INTEGER

INPUT X
INPUT Y

Temp ← X
X ← Y
Y ← Temp

OUTPUT "X: ", X
OUTPUT "Y: ", Y
▶ Run in PseudoStudio IDE
TOPIC 2

Conditionals & Selection (IF / ELSE / CASE)

Practice decision-making logic using nested IF...THEN...ELSE...ENDIF and logical operators (AND, OR, NOT).

NESTED IF / SELECTION MEDIUM • 5 MARKS

Question 4: Student Exam Grade Classification

Write a pseudocode algorithm that inputs a student's score (0 to 100). Output "Distinction" if score ≥ 80, "Merit" if score ≥ 60, "Pass" if score ≥ 40, and "Fail" otherwise.

👁️ Show Model Answer & Solution Code
DECLARE Score : INTEGER
INPUT Score

IF Score >= 80 THEN
    OUTPUT "Distinction"
ELSE
    IF Score >= 60 THEN
        OUTPUT "Merit"
    ELSE
        IF Score >= 40 THEN
            OUTPUT "Pass"
        ELSE
            OUTPUT "Fail"
        ENDIF
    ENDIF
ENDIF
▶ Run in PseudoStudio IDE
SELECTION & BOUNDARIES EASY • 4 MARKS

Question 5: Movie Ticket Pricing Structure

Write an algorithm that prompts for a customer's Age (INTEGER). If Age < 12 output "Child: $5", if Age < 65 output "Adult: $12", otherwise output "Senior: $8".

👁️ Show Model Answer & Solution Code
DECLARE Age : INTEGER
INPUT Age

IF Age < 12 THEN
    OUTPUT "Child: $5"
ELSE
    IF Age < 65 THEN
        OUTPUT "Adult: $12"
    ELSE
        OUTPUT "Senior: $8"
    ENDIF
ENDIF
▶ Run in PseudoStudio IDE
LOGICAL OPERATORS (OR) MEDIUM • 5 MARKS

Question 6: Month Days & Leap Year Logic

Write a pseudocode algorithm that inputs a Month number (1 to 12). If Month is 2, output "28 or 29 days". If Month is 4, 6, 9, or 11 output "30 days". Otherwise output "31 days".

👁️ Show Model Answer & Solution Code
DECLARE Month : INTEGER
INPUT Month

IF Month = 2 THEN
    OUTPUT "28 or 29 days"
ELSE
    IF Month = 4 OR Month = 6 OR Month = 9 OR Month = 11 THEN
        OUTPUT "30 days"
    ELSE
        OUTPUT "31 days"
    ENDIF
ENDIF
▶ Run in PseudoStudio IDE
TOPIC 3

Iteration & Loops (FOR / WHILE / REPEAT)

Master definite iteration (FOR...TO...NEXT) and indefinite iteration (WHILE...DO...ENDWHILE, REPEAT...UNTIL).

DEFINITE ITERATION (FOR) MEDIUM • 5 MARKS

Question 7: Calculate Total Sum and Average of N Inputs

Write a pseudocode algorithm that inputs 5 integer values using a FOR loop, accumulates their total sum, computes their rounded average, and outputs both results.

👁️ Show Model Answer & Solution Code
DECLARE Val : INTEGER
DECLARE Total : INTEGER
DECLARE Average : INTEGER
DECLARE i : INTEGER

Total ← 0

FOR i ← 1 TO 5
    INPUT Val
    Total ← Total + Val
NEXT i

Average ← ROUND(Total / 5)
OUTPUT "Total: ", Total
OUTPUT "Average: ", Average
▶ Run in PseudoStudio IDE
INDEFINITE ITERATION (WHILE) EASY • 4 MARKS

Question 8: Multiples of 3 Generator

Write an algorithm using a WHILE loop to print all positive multiples of 3 strictly less than 20 (i.e. 3, 6, 9, 12, 15, 18).

👁️ Show Model Answer & Solution Code
DECLARE Num : INTEGER
Num ← 3

WHILE Num < 20 DO
    OUTPUT Num
    Num ← Num + 3
ENDWHILE
▶ Run in PseudoStudio IDE
POST-CONDITION LOOP (REPEAT) HARD • 6 MARKS

Question 9: Factorial Calculator Using REPEAT Loop

Write a pseudocode algorithm that inputs a positive integer N (e.g. 5) and computes its factorial (N!) using a REPEAT...UNTIL loop.

👁️ Show Model Answer & Solution Code
DECLARE N : INTEGER
DECLARE Fact : INTEGER
DECLARE Count : INTEGER

INPUT N
Fact ← 1
Count ← 1

REPEAT
    Fact ← Fact * Count
    Count ← Count + 1
UNTIL Count > N

OUTPUT "Factorial: ", Fact
▶ Run in PseudoStudio IDE
TOPIC 4

Data Structures & 1D/2D Arrays

Practice 1-indexed array declarations (ARRAY[1:N] OF INTEGER), linear search, and finding maximum/minimum values.

ARRAY TRAVERSAL MEDIUM • 6 MARKS

Question 10: Find Highest Mark in a Class Array

An array Marks[1:5] contains 5 student marks: [65, 82, 45, 92, 78]. Write a pseudocode algorithm to loop through the array and find and output the highest mark.

👁️ Show Model Answer & Solution Code
DECLARE Marks : ARRAY[1:5] OF INTEGER
DECLARE Max : INTEGER
DECLARE i : INTEGER

Marks[1] ← 65
Marks[2] ← 82
Marks[3] ← 45
Marks[4] ← 92
Marks[5] ← 78

Max ← Marks[1]

FOR i ← 2 TO 5
    IF Marks[i] > Max THEN
        Max ← Marks[i]
    ENDIF
NEXT i

OUTPUT "Highest Mark: ", Max
▶ Run in PseudoStudio IDE
LINEAR SEARCH HARD • 6 MARKS

Question 11: Array Linear Search Algorithm

Given an array Scores[1:4] = [12, 45, 67, 89], write an algorithm that inputs a SearchVal. Output "Found at index X" if present, or "Not Found" if the value is not in the array.

👁️ Show Model Answer & Solution Code
DECLARE Scores : ARRAY[1:4] OF INTEGER
DECLARE SearchVal : INTEGER
DECLARE Found : BOOLEAN
DECLARE i : INTEGER

Scores[1] ← 12
Scores[2] ← 45
Scores[3] ← 67
Scores[4] ← 89

INPUT SearchVal
Found ← FALSE

FOR i ← 1 TO 4
    IF Scores[i] = SearchVal THEN
        OUTPUT "Found at index: ", i
        Found ← TRUE
    ENDIF
NEXT i

IF Found = FALSE THEN
    OUTPUT "Not Found"
ENDIF
▶ Run in PseudoStudio IDE
ARRAY ACCUMULATION EXAM PAPER • 7 MARKS

Question 12: Array Sum, Average, and Threshold Counter

Write a pseudocode algorithm that declares an array Scores of 10 integers. Prompt the user to input 10 scores, calculate the total sum and average score, and output the count of scores greater than 50.

👁️ Show Model Answer & Solution Code
DECLARE Scores : ARRAY[1:10] OF INTEGER
DECLARE Total, Count, I : INTEGER
DECLARE Average : REAL

Total ← 0
Count ← 0

FOR I ← 1 TO 10
    OUTPUT "Enter score ", I, ":"
    INPUT Scores[I]
    Total ← Total + Scores[I]
    IF Scores[I] > 50 THEN
        Count ← Count + 1
    ENDIF
NEXT I

Average ← Total / 10
OUTPUT "Total:", Total
OUTPUT "Average:", Average
OUTPUT "Scores > 50:", Count
▶ Run in PseudoStudio IDE
TOPIC 5

Functions, Subroutines & Parameters

Practice defining FUNCTION...RETURNS, calling subroutines with parameters, and handling return values.

FUNCTIONS & RETURN MEDIUM • 4 MARKS

Question 13: Rectangle Area Function

Write a pseudocode FUNCTION CalcArea(W : REAL, H : REAL) RETURNS REAL that returns the calculated rectangle area (W * H). Call the function with Width = 5.0 and Height = 4.0 and output the area.

👁️ Show Model Answer & Solution Code
FUNCTION CalcArea(W : REAL, H : REAL) RETURNS REAL
    RETURN W * H
ENDFUNCTION

DECLARE Area : REAL
Area ← CalcArea(5.0, 4.0)
OUTPUT "Area: ", Area
▶ Run in PseudoStudio IDE
BOOLEAN FUNCTIONS EASY • 4 MARKS

Question 14: IsEven Check Function

Write a FUNCTION IsEven(N : INTEGER) RETURNS BOOLEAN that returns TRUE if N MOD 2 = 0, otherwise FALSE. Call the function with 14 and output "Even" or "Odd".

👁️ Show Model Answer & Solution Code
FUNCTION IsEven(N : INTEGER) RETURNS BOOLEAN
    IF N MOD 2 = 0 THEN
        RETURN TRUE
    ELSE
        RETURN FALSE
    ENDIF
ENDFUNCTION

IF IsEven(14) THEN
    OUTPUT "Even"
ELSE
    OUTPUT "Odd"
ENDIF
▶ Run in PseudoStudio IDE
TOPIC 6

Trace Tables & Output Prediction

Practice dry-running algorithms on paper or interactive matrices to track changing variable states line by line.

TRACE TABLE DRY RUN EXAM PAPER 2 • 8 MARKS

Question 15: Dry Run Trace Table for Even Sum Loop

Complete the trace table for the given algorithm when the input values are 14, 27, 8, 32, -1.

Count ← 0 Sum ← 0 INPUT Value WHILE Value <> -1 DO IF Value MOD 2 = 0 THEN Sum ← Sum + Value Count ← Count + 1 ENDIF INPUT Value ENDWHILE OUTPUT "Even Sum:", Sum
👁️ Show Expected Trace Matrix
Count Sum Value OUTPUT
0014
11427
8
22232
354-1
354-1Even Sum: 54
📊 Solve Interactive Trace Tables →
CUSTOM TEST GENERATOR

Build Your Custom AI Practice Exam

Select your syllabus, difficulty, and target topics to generate an instant, automated practice session with real-time feedback.

01 SELECT SYLLABUS
IGCSE Computer Science (0478/0984)
A-Level Computer Science (9618)
General Pseudocode Practice
02 PRACTICE MODE
💻 Pseudocode Coding & Verification
📊 Trace Table Dry Runs
03 SELECT PRACTICE TOPICS (CLICK TO TOGGLE)
FOR / WHILE / REPEAT Loops
Variables & Constants
IF / CASE Statements
1D & 2D Arrays
Functions & Procedures
String Manipulation
Input Validation
Sorting Algorithms
File Handling
Trace Tables
04 DIFFICULTY LEVEL
Easy (Foundational)
Medium (Standard)
Hard (Advanced)
Exam Paper Challenge
05 NUMBER OF QUESTIONS
3 Questions
5 Questions
10 Questions
CUSTOM TEST SUMMARY

Practice Session Ready

IGCSE 0478/0984

25 Marks

ESTIMATED SCORE

18 Mins

TARGET DURATION

2 TOPICS SELECTED
FOR / WHILE / REPEAT Loops Variables & Constants

🔒 Free 1-click Google Sign-in to unlock and save progress

How to Excel in Cambridge Computer Science Pseudocode Exams

1. Keyword Capitalization

Cambridge mark schemes strictly require keywords in UPPERCASE: DECLARE, INPUT, OUTPUT, IF...THEN...ELSE...ENDIF, FOR...TO...NEXT.

2. Arrow Assignment (←)

Variable assignment uses (or <-), never =. The = symbol is reserved strictly for equality tests in IF conditions.

3. 1-Indexed Arrays

Unlike Python or Java, Cambridge pseudocode arrays are indexed starting from 1 by default: DECLARE StudentNames : ARRAY[1:30] OF STRING.

FAQ

Frequently Asked Questions

Where can I find free pseudocode practice questions with answers?
PseudoStudio provides a free online IDE, compiler, and practice question bank designed specifically for Cambridge IGCSE (0478/0984) and A-Level (9618) Computer Science students. You can browse static practice questions by topic or generate custom tests.
What is the difference between Paper 2 pseudocode and real programming languages?
Pseudocode is a high-level algorithmic language designed for human readability and exam grading. Unlike Python or Java, Cambridge pseudocode requires mandatory keyword capitalization, arrow assignment (), explicit variable declarations with types, and 1-indexed arrays.
How are trace table practice questions evaluated?
PseudoStudio dry-runs your pseudocode and generates the canonical step-by-step state matrix. When you complete a trace table practice exercise, our system automatically compares every single cell value and provides instant column-by-column feedback.