Software Engineering › Flashcards › Code reading questions
Flashcards for Code reading questions
62 cards where the term can be tested as a code reading question. Study these as flip cards Random
Pseudocode Term Programming Fundamentals (Year 11)
Structured, language-independent English-like code: keywords in capitals (IF, ELSE, WHILE, ENDWHILE, FOR, NEXT, SET, GET, DISPLAY), paired structures and consistent indentation.
Example: Always write a mainline plus subroutines, use indentation and close every structure (ENDIF, ENDWHILE).
- Pseudocode: Write an algorithm in the exam pseudocode editor
- Code reading: Read pseudocode and give the output
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design; Sample exam Q14 (3 marks): Algorithm design (subroutines); Familiarisation Q8 (3 marks): Algorithm design (linear search)
Desk checking Term Programming Fundamentals (Year 11)
Manually stepping through an algorithm with sample data and recording variable values (a trace table) to check it works before coding.
Example: A trace table has a column for each variable and a row for each step.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Short answer: Outline desk checking
- Code reading: Trace pseudocode
Related past questions: 2022 Software Design and Development HSC Q28 (6 marks): Desk check and debugging an algorithm; 2023 Software Design and Development HSC Q28 (6 marks): Desk check and debugging (validation)
Inputs, outputs and purpose of an algorithm Term Programming Fundamentals (Year 11)
When analysing an algorithm, identify the data it takes in (inputs), the results it produces (outputs), what it is designed to do (purpose) and how it connects to other subroutines.
Example: 'Inputs: array of marks. Output: the average. Purpose: calculate the class mean.'
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Short answer: State what the algorithm does
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design
Check this one: Not found word-for-word in the supplied syllabus, specifications, marking guidelines or notes; the definition is standard computing knowledge, so check it against your class notes.
Linear search Term Programming Fundamentals (Year 11)
A search that checks each item in order until the target is found or the list ends. Works on unsorted data; slow for large lists.
Example: 'FOR i = 0 TO length-1: IF list[i] == target THEN found.'
- Pseudocode: Search an array for a value
- Python: Python question: write or complete it in the online Python tool.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Familiarisation Q8 (3 marks): Algorithm design (linear search); 2021 Software Design and Development HSC Q29 (3 marks): Tracing an algorithm (linear search)
Check this one: Not named in the syllabus; it appears in past questions and the school notes.
Binary search Term Programming Fundamentals (Year 11)
A search on a SORTED list that checks the middle item and discards half the list each time (a divide and conquer method).
Example: 'Binary search needs sorted data; each step halves the search space.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Related past questions: 2021 Software Design and Development HSC Q28 (5 marks): Debugging an algorithm (binary search)
Check this one: Not named in the syllabus; it appears in past SDD questions.
Recursion Term Programming Fundamentals (Year 11)
A subroutine that calls itself on a smaller version of the problem until it reaches a base case that stops it.
Example: 'Factorial: n * factorial(n-1) with base case n = 0.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python question: write or complete it in the online Python tool.
Check this one: Not named in the 2022 syllabus text; included because of the functional paradigm and past SDD coding questions.
Array Term Programming Fundamentals (Year 11)
A data structure holding a fixed number of items of the same type, accessed by index; can be single or multi-dimensional (rows and columns).
Example: 'marks[0]' is the first item.
- Pseudocode: Iterate and sum an array
- Python: 2D list
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design; Sample exam Q21a (1 mark): 2D arrays (Python); Sample exam Q21b (5 marks): Python: subroutines, lists, loops
Memorise: Data structures
Multi-dimensional array Term Programming Fundamentals (Year 11)
An array of arrays, used for grids or tables and accessed by row and column index, such as grid[row][col].
Example: 'grid[2][3]' is row 2, column 3.
- Python: 2D list
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: Sample exam Q21a (1 mark): 2D arrays (Python); Sample exam Q21b (5 marks): Python: subroutines, lists, loops; 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python)
Memorise: Data structures
List Term Programming Fundamentals (Year 11)
An ordered, changeable collection of items (Python list) that can grow and shrink and can hold mixed types.
Example: 'scores = [3, 5]; scores.append(8)'
- Python: append, index, loop
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python); Sample exam Q21b (5 marks): Python: subroutines, lists, loops
Memorise: Data structures
Stack Term Programming Fundamentals (Year 11)
A last-in, first-out (LIFO) structure where items are added (push) and removed (pop) at the top.
Example: 'Undo uses a stack.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Memorise: Data structures
Logic error Term Programming Fundamentals (Year 11)
The program runs but gives the wrong result because the algorithm is wrong, for example using > instead of >=. 2025 markers said students confused these with syntax errors.
Example: 'Average = total / 2 instead of total / count.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Short answer: Outline how a debugging tool finds logic errors
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q15b (3 marks): Testing and debugging
Memorise: Testing and code quality (Year 11)
Object Term The Object-Oriented Paradigm (Year 11)
A single instance of a class with its own attribute values and the ability to run the class's methods.
Example: 's1 = Student("Ava")' creates an object.
- Python: create an object
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q22 (3 marks): Modelling tools
Memorise: Object-oriented concepts
Constructor (__init__) Term The Object-Oriented Paradigm (Year 11)
A special method that runs when an object is created and sets its starting attribute values (in Python it is __init__).
Example: 'def __init__(self, name): self.name = name'
- Python: Write a class with __init__
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Memorise: Object-oriented concepts
Check this one: The syllabus says implement OOP code but does not name constructors; Python classes need __init__ so it is a safe code-pattern card.
Polymorphism Term The Object-Oriented Paradigm (Year 11)
Different classes provide their own version of the same method name, so one call behaves differently depending on the object.
Example: 'speak() prints Woof for Dog and Meow for Cat.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Python: override a method
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Memorise: Object-oriented concepts
Method overriding Term The Object-Oriented Paradigm (Year 11)
A subclass supplies its own version of a method it inherited, replacing the parent's version; the way polymorphism is coded.
Example: 'Cat.speak() overrides Animal.speak().'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Memorise: Object-oriented concepts
Check this one: Not named in the syllabus; it is how polymorphism is shown in Python code.
Message passing Term The Object-Oriented Paradigm (Year 11)
Objects communicate by calling each other's methods (sending a message with parameters and receiving a return value).
Example: 'order.addItem(item) sends the message addItem to the order object.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Short answer: Investigate how OOP languages handle message passing
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Memorise: Object-oriented concepts
Control algorithm pattern (line follower) Code pattern Programming Mechatronics (Year 11)
A closed-loop loop: WHILE the robot is running, read the sensor, IF the sensor sees dark THEN turn one way ELSE turn the other, ENDIF, ENDWHILE.
Example: 'WHILE on: read light; IF dark THEN turn left ELSE turn right.'
- Pseudocode: Write a control loop
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Memorise: Mechatronics: hardware, sensors, actuators, control
Check this one: Not found word-for-word in the supplied syllabus, specifications, marking guidelines or notes; the definition is standard computing knowledge, so check it against your class notes.
SQL injection Term Secure Software Architecture (Year 12)
An attack where malicious SQL is inserted through input so it runs on the database; stopped by parameterised queries and validation.
Example: "' OR 1=1 --" typed into a login box.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Sample exam Q18a (3 marks): Defensive data input handling
Memorise: Describe the benefits of developing secure software
Check this one: The course specification names XSS and defensive input handling; SQL injection is the standard example the school notes use.
Cascading style sheets (CSS) Term Programming for the Web (Year 12)
Style rules that control the appearance of web pages, kept separate from HTML. Benefits: consistent appearance, flexibility across browsers and display devices, and easier maintenance.
Example: 'One CSS file changes the font on every page.'
- Short answer: Outline benefits of CSS (sample Q16b)
- Code reading: Read CSS and pick the result (2025 Q7, sample Q16a)
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: 2025 HSC Q7 (1 mark): CSS code fragment; Sample exam Q16a (1 mark): CSS (id v class); Sample exam Q16b (2 marks): CSS benefits
Memorise: Web development system: front end, back end, databases
CSS selectors (id v class) Code pattern Programming for the Web (Year 12)
A class selector (.name) styles many elements; an id selector (#name) styles one unique element.
Example: '.button { color: white } styles every element with class button.'
- Code reading: 2025 Q7 and sample Q16a: read a CSS fragment
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: 2025 HSC Q7 (1 mark): CSS code fragment; Sample exam Q16a (1 mark): CSS (id v class)
Memorise: Web development system: front end, back end, databases
Shell commands (mkdir, cd, touch, cp, rm, cat, grep) Code pattern Programming for the Web (Year 12)
Command line tools used in scripts: mkdir makes a directory, cd changes directory, touch creates a file, cp copies, rm removes, cat shows file contents, grep searches a text file for a pattern.
Example: 'grep "error" log.txt searches log.txt.'
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Matching or table: Matching or table question: match it to its description, example or category.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
Memorise: SQL vs ORM
SQL SELECT Code pattern Programming for the Web (Year 12)
Chooses the fields (columns) to return from a table: SELECT name, mark FROM students; SELECT * returns all columns.
Example: 'SELECT FirstName FROM Customer;'
- SQL: Select fields
- Fill in the blanks: Complete the query (sample Q22a)
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multi-select: Multi-select: you tick every correct option, so know all its features or goals.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q17 (3 marks): SQL (join, filter, order); Familiarisation Q12a (2 marks): SQL
Memorise: SQL vs ORM
SQL WHERE Code pattern Programming for the Web (Year 12)
Filters rows using conditions (=, <>, >, <, AND, OR). Text values need quotes. 2025 marker note: use quotes around searched text and combine conditions with AND or OR.
Example: "WHERE Suburb = 'Parramatta' AND Age > 18"
- SQL: SQL question: write or read it in the SQL query tool.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multi-select: Multi-select: you tick every correct option, so know all its features or goals.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q17 (3 marks): SQL (join, filter, order); Familiarisation Q12b (3 marks): SQL (joins, AS)
Memorise: SQL vs ORM
SQL ORDER BY Code pattern Programming for the Web (Year 12)
Sorts results by a field, ascending (ASC, the default) or descending (DESC).
Example: 'ORDER BY mark DESC'
- SQL: SQL question: write or read it in the SQL query tool.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q17 (3 marks): SQL (join, filter, order)
Memorise: SQL vs ORM
SQL GROUP BY Code pattern Programming for the Web (Year 12)
Groups rows that share a value so aggregate functions (COUNT, SUM, AVG, MIN, MAX) can be applied to each group.
Example: 'SELECT class, COUNT(*) FROM students GROUP BY class;'
- SQL: 2025 Q21 and sample Q22a
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multi-select: Multi-select: you tick every correct option, so know all its features or goals.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q22a (2 marks): SQL (GROUP BY)
Memorise: SQL vs ORM
SQL aggregate functions (COUNT, SUM, AVG) Code pattern Programming for the Web (Year 12)
Functions that calculate one value from many rows: COUNT (number), SUM (total), AVG (mean), MIN and MAX.
Example: 'SELECT AVG(mark) FROM results;'
- SQL: SQL question: write or read it in the SQL query tool.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q22a (2 marks): SQL (GROUP BY)
Memorise: SQL vs ORM
SQL alias (AS) Code pattern Programming for the Web (Year 12)
Gives a table or column a temporary name to make queries shorter and clearer: SELECT s.name AS student FROM Student AS s.
Example: 'FROM Student AS s JOIN Class AS c'
- SQL: SQL question: write or read it in the SQL query tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Familiarisation Q12b (3 marks): SQL (joins, AS)
Memorise: SQL vs ORM
Check this one: Not found word-for-word in the supplied syllabus, specifications, marking guidelines or notes; the definition is standard computing knowledge, so check it against your class notes.
OOP for ML programming Code pattern Software Automation (Year 12)
ML models are written as classes: attributes hold data and weights, methods train, predict and evaluate.
Example: 'model = LinearRegression(); model.fit(x, y); model.predict([[5]])'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Memorise: Decision trees
Neural network code (predict) Code pattern Software Automation (Year 12)
Create the model object, train (fit) on training data, then call predict on new data to make predictions.
Example: 'net.fit(X, y); net.predict(new)'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Memorise: Decision trees
Flowchart Diagram Diagrams and Modelling Tools (Years 11 and 12)
Represents an algorithm with standard symbols connected by lines with arrowheads, read top to bottom and left to right, using only the standard control structures. Label arrows leaving a decision (Yes or No).
Example: 'Diamond: age >= 18? Yes: Display Adult.'
- Drawing: Draw a flowchart
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Related past questions: 2021 Software Design and Development HSC Q22 (3 marks): Testing (live test data)
Memorise: Drawing rules: DFD, structure chart, storyboard, decision tree, class diagram, ERD
Pseudocode keywords Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Keywords are in capitals; structural elements come in pairs (BEGIN/END, IF/ENDIF, WHILE/ENDWHILE); indent to show control structures.
Example: 'IF mark >= 50 THEN ... ENDIF'
- Pseudocode: Write pseudocode (2025 Q17)
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design; Sample exam Q7 (1 mark): Python to pseudocode; Sample exam Q14 (3 marks): Algorithm design (subroutines); Familiarisation Q8 (3 marks): Algorithm design (linear search)
Memorise: Python and SQL you must be able to write
Sequence Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Steps executed one after another in the order written.
Example: 'GET a; GET b; total = a + b'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Drawing: Drawing question: draw or label it in the online drawing tool.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design
Memorise: Python and SQL you must be able to write
Binary selection (IF THEN ELSE) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
IF condition THEN process ELSE other process ENDIF: one of two paths is taken.
Example: 'IF age >= 18 THEN DISPLAY "Adult" ELSE DISPLAY "Minor" ENDIF'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Drawing: Drawing question: draw or label it in the online drawing tool.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design
Memorise: Python and SQL you must be able to write
Multi-way selection (CASEWHERE) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
CASEWHERE expression evaluates to choice a: ... OTHERWISE: default END CASE; only one process runs.
Example: 'CASEWHERE grade evaluates to "A": ... OTHERWISE: ...'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Drawing: Drawing question: draw or label it in the online drawing tool.
Memorise: Python and SQL you must be able to write
Nested IF Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
An IF inside the ELSE of another IF to test several conditions where only one process runs.
Example: 'IF a THEN ... ELSE IF b THEN ... ELSE ... ENDIF ENDIF'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python question: write or complete it in the online Python tool.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design
Memorise: Python and SQL you must be able to write
WHILE loop (pre-test) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
WHILE condition is true ... ENDWHILE: the condition is tested before each loop, so the body may never run.
Example: 'WHILE count < 5 ... ENDWHILE'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python while
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design; Sample exam Q9 (2 marks): Algorithm design (guessing game)
Memorise: Python and SQL you must be able to write
REPEAT UNTIL loop (post-test) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
REPEAT ... UNTIL condition is true: the body runs at least once, then the condition is tested.
Example: 'REPEAT GET guess UNTIL guess = answer'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Sample exam Q9 (2 marks): Algorithm design (guessing game)
Memorise: Python and SQL you must be able to write
FOR / NEXT loop (counted) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
FOR variable = start TO finish STEP increment ... NEXT variable; used when the number of repeats is known.
Example: 'FOR i = 1 TO 5 ... NEXT i'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python question: write or complete it in the online Python tool.
Related past questions: 2025 HSC Q17 (3 marks): Algorithm design
Memorise: Python and SQL you must be able to write
Check this one: Not found word-for-word in the supplied syllabus, specifications, marking guidelines or notes; the definition is standard computing knowledge, so check it against your class notes.
Subroutine and function (pseudocode) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
BEGIN name (parameters) ... END name. A function returns a single value with RETURN.
Example: 'BEGIN Add (x, y) total = x + y RETURN total END Add'
- Pseudocode: Pseudocode question: use it correctly in the exam pseudocode editor.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python question: write or complete it in the online Python tool.
Related past questions: Sample exam Q14 (3 marks): Algorithm design (subroutines)
Memorise: Python and SQL you must be able to write
Python input and output Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
input() reads text from the user as a string; print() displays output; convert with int() or float().
Example: 'age = int(input("Age: "))'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q19 (3 marks): Developing secure code (Python); Sample exam Q18b (3 marks): Developing secure code (Python input validation)
Python selection (if elif else) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
if condition: ... elif condition: ... else: ...; indentation matters (Q19 marker note: indentation).
Example: 'if mark >= 50: print("Pass") else: print("Fail")'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q19 (3 marks): Developing secure code (Python)
Python for loop and range Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
for i in range(start, stop): repeats; stop is exclusive; also loops over lists and strings.
Example: 'for i in range(1, 6): print(i)'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python)
Python while loop Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
while condition: ... repeats while True; make sure the condition changes.
Example: 'while guess != answer: guess = int(input())'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Sample exam Q9 (2 marks): Algorithm design (guessing game)
Python strings and slicing Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Strings are sequences: len(s), s[0], s[-1], s[1:4], s.upper(), s.lower(), s.split(), s.strip(), and ord()/chr() for character codes.
Example: 'word[0] is the first letter; word[-1] is the last.'
- Python: String processing (2025 Q19)
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q19 (3 marks): Developing secure code (Python)
Python lists Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
A list stores ordered items: append(), remove(), len(), sorting with sort(), looping, and 2D lists as a list of lists.
Example: 'grid = [[0]*3 for _ in range(3)]'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python); Familiarisation Q13 (6 marks): Python: lists, loops, selection; Sample exam Q21b (5 marks): Python: subroutines, lists, loops
Python 2D list (grid) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
A list of lists addressed as grid[row][column]; loop with nested for loops.
Example: 'grid[1][2] = 5'
- Python: Grid (2025 Q26, sample Q21)
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python); Sample exam Q21a (1 mark): 2D arrays (Python); Sample exam Q21b (5 marks): Python: subroutines, lists, loops
Python random numbers Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
import random then random.randint(a, b) gives a whole number a to b inclusive; use a set or a check to avoid repeats.
Example: 'n = random.randint(1, 50)'
- Python: 2025 Q26 random grid
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q26 (5 marks): Design, construct and implement a solution (Python)
Check this one: Library use is allowed under 'modules and libraries'; random.randint is a standard Python function.
Python functions Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
def name(parameters): ... return value. Functions must be defined before they are called (2025 Q19 marker note: call functions after definition).
Example: 'def area(w, h): return w * h'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q19 (3 marks): Developing secure code (Python)
Global and local variables Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
A local variable exists only inside its function; a global variable is declared outside and can be used throughout (use the global keyword to change it inside a function).
Example: 'count = 0 (global); def add(): global count'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Python file handling Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
open(filename, mode) with modes r (read), w (write, overwrites), a (append); use with to close the file automatically; read(), readline(), write().
Example: 'with open("data.txt") as f: lines = f.readlines()'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Python modules and libraries Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
import a module to use its functions: import random, import math, from sklearn.linear_model import LinearRegression.
Example: 'import math'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Python classes and objects Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
class Name: with __init__(self, ...) to set attributes; methods have self; create objects with Name(...); inheritance with class Child(Parent):.
Example: 'class Dog(Animal): def speak(self): return "Woof"'
- Python: Write a class
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q22 (3 marks): Modelling tools
Python try / except Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
try: risky code except ValueError: handle the error; keeps the program running with a helpful message.
Example: 'except ValueError: print("Numbers only")'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: Sample exam Q18b (3 marks): Developing secure code (Python input validation)
Python sqlite3 parameterised query Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Use ? placeholders and pass values separately, never join user text into the SQL string, to stop SQL injection.
Example: 'cur.execute("SELECT * FROM user WHERE name = ?", (name,))'
- Python: Python question: write or complete it in the online Python tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Check this one: Parameterised queries are standard secure practice (defensive input handling); the syllabus does not name sqlite3.
Python file and ML code reading (scikit-learn) Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Know how to read: import, create the model, fit (train), predict.
Example: 'model.fit(x, y); model.predict([[4]])'
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Python: Python question: write or complete it in the online Python tool.
SQL statement structure Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
SELECT fields FROM table WHERE criteria GROUP BY field ORDER BY field ASC or DESC; keyword AS renames a field for display.
Example: 'SELECT Name FROM Games WHERE Cost > 20 ORDER BY Name ASC'
- SQL: Write a query (2025 Q21)
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multi-select: Familiarisation Q2
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q17 (3 marks): SQL (join, filter, order); Familiarisation Q12a (2 marks): SQL; Familiarisation Q12b (3 marks): SQL (joins, AS)
Memorise: SQL: HSC syntax and must-know queries
SQL relational and logical operators Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Relational operators: CONTAINS, DOES NOT CONTAIN, EQUALS, NOT EQUAL TO, GREATER THAN (OR EQUAL TO), LESS THAN (OR EQUAL TO). Logical operators: AND, OR, NOT. Put text and dates in quotes.
Example: "WHERE Name CONTAINS 'war' AND Cost < 50"
- SQL: SQL question: write or read it in the SQL query tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries
Memorise: SQL: HSC syntax and must-know queries
SQL calculated aggregate with GROUP BY Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
SELECT Developer, SUM(Cost) AS Totalcost FROM Games GROUP BY Developer ORDER BY Developer DESC.
Example: 'SUM (Games.cost) AS Totalcost'
- SQL: SQL question: write or read it in the SQL query tool.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Related past questions: 2025 HSC Q21 (4 marks): SQL queries; Sample exam Q22a (2 marks): SQL (GROUP BY)
Memorise: SQL: HSC syntax and must-know queries
CSS rule syntax Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
selector { property: value; } with comments in /* */. h1 targets an element, #welcome targets an id, .red-text targets a class.
Example: '.red-text { color: red; }'
- Code reading: Read CSS (2025 Q7)
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Related past questions: 2025 HSC Q7 (1 mark): CSS code fragment; Sample exam Q16a (1 mark): CSS (id v class)
Memorise: SQL: HSC syntax and must-know queries
XSS JavaScript fragment reading Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
Be able to read a short JavaScript fragment and spot where untrusted input is inserted into a page without sanitising.
Example: 'element.innerHTML = userInput is unsafe.'
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
Related past questions: Familiarisation Q11a (1 mark): Cross-site scripting; Familiarisation Q11b (2 marks): Cross-site scripting
Memorise: SQL: HSC syntax and must-know queries
Shell script pattern Code pattern Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12)
A script is a text file of commands run in order, e.g. mkdir site, cd site, touch index.html, cp, rm, cat, grep.
Example: 'mkdir site && cd site && touch index.html'
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
- Multiple choice: Multiple choice: pick the option that matches the definition or example.
Memorise: SQL: HSC syntax and must-know queries
Interpret Command word Command Words and Question-type Skills
Draw meaning from.
Example: 'Interpret the code fragment.'
- Short answer: Short answer (2 to 4 marks): define, outline or explain it and tie it to the scenario.
- Code reading: Code or algorithm reading: interpret a fragment and state its output or purpose.
Memorise: NESA key verbs: what each one asks for