Checking and testing AI-generated code
Read and trace AI code, then test it with your own boundary and invalid data, and check it meets the requirements. It can look right but be wrong or use made-up functions.
Understanding Checking and testing AI-generated code in VCE Software Development U3O1
What it does: A trace table is how you read and trace AI code step by step to find out what it really does, rather than assuming it works. Passing text where a number is expected is invalid test data, and it shows whether the AI code handles wrong input safely. Boundary values (0 and 100) and values just outside the range (-1 and 101) are the most likely to expose errors in AI code. The code should use >= and <=. Boundary testing with 0 and 100 would catch this logic error. AI tools sometimes invent functions or libraries. Check the official documentation. Here, sum(prices) is the real function.
Common mistakes: The requirement says a mark of 50 passes. Testing the boundary value 50 returns False with >, so the AI code is wrong. It should be >=. math.squareroot() does not exist. AI tools can make up functions that look real. Check the documentation. The real function is math.sqrt().
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 178–193) and word search (Modules 168–193).
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
Verify AI-generated codeFill in the Blanks
Spot the Error
Student with a class code? Join your class →