Back to marketplace

2.2.1 Programming Techniques

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

Define the programming construct sequence

Back (Answer)

Code is executed line-by-line, from top-to-bottom.

#2
Front (Question)

Define the programming construct iteration

Back (Answer)

When instructions/code are executed repeatedly.

#3
Front (Question)

Define condition-controlled iteration and give examples of it

Back (Answer)

Condition-controlled is when a group of instructions is repeated until a given condition is met. e.g. while, do while and repeat until loops

#4
Front (Question)

Define count-controlled iteration and give examples of it

Back (Answer)

When a group of instructions is repeated a specific number of times. e.g. for and for each loops

#5
Front (Question)

Define the programming construct branching

Back (Answer)

Also called selection. When instructions/code are only executed if a certain condition is met.

#6
Front (Question)

How can selection be utilised?

Back (Answer)

Through IF, ELSEIF and ELSE statements and case statement

#7
Front (Question)

Describe a recursive function

Back (Answer)

A recursive function calls itself. Each call will create a new copy of the values in the function and add all of the values of the copy the call is being made from to a stack. It has a base case (condition) that stops the recursive call, and can have multiple base cases.

#8
Front (Question)

How can recursion be utilised / how is it formatted?

Back (Answer)

Recursion is utilised when a function contains an if statement in which each if/else is followed by returning data e.g. function factorial(number) if number == 0 or 1: return 1 else: return number * factorial(number - 1); endif end function

#9
Front (Question)

How do recursion and iteration differ?

Back (Answer)

• Recursion uses more memory / iteration uses less memory • Recursion can run out of memory / iteration cannot run out of memory • Recursion declares new variables / iteration reuses the same variables • Recursion can express a problem in fewer lines of code / iteration can take more lines of code • Recursion will call itself / iteration doesn’t

#10
Front (Question)

Define variables and constants.

Back (Answer)

A named memory address that holds a value of a given data type. A variable can change as the program is running. A constant can not change while the program is running.

#11
Front (Question)

Define a local variable

Back (Answer)

Local variables​ have limited scope which means that they can only be​ ​accessed within the block of code in which they were defined​.

#12
Front (Question)

Give 2 advantages of local variables

Back (Answer)

• Less memory is used • Self-contained so unaffected by code outside of the subroutine • Take precedence over global variables with the same name • Increases data integrity

#13
Front (Question)

Give disadvantages of local variables

Back (Answer)

• Cannot be accessed directly by other subroutines • It has to be passed into a subroutine as a parameter

#14
Front (Question)

Define a global variable

Back (Answer)

Global variables can be accessed from anywhere in the / across the whole program.

#15
Front (Question)

Give 2 advantages of global variables

Back (Answer)

• Value doesn’t need passing as a parameter • Don’t need to return a value • Can be accessed from anywhere in the program • Persistent, maintaining their values throughout execution, making them suited to some constants

#16
Front (Question)

Give disadvantages of global variables

Back (Answer)

• Reduces data integrity as changing a global variable may have an impact on another module • Uses more memory because the memory space is declared when the program starts and remains in use throughout • Makes testing / debugging more difficult as it’s difficult to test an individual block of code

#17
Front (Question)

Describe modularity

Back (Answer)

Modular programming is a programming technique used to ​split large, complex programs into smaller, self-contained modules​.

#18
Front (Question)

Describe and compare functions and procedures

Back (Answer)

Procedures and functions are both ​named blocks of code that perform a specific task. While​ procedures do not have to return a value​,​ functions must always return a value​.

#19
Front (Question)

What is the advantage of a procedure over a function?

Back (Answer)

• Procedures can return multiple values whereas a function must return one, single value

#20
Front (Question)

Define a parameter

Back (Answer)

A parameter is a piece of data that is input into a code block so that it can complete its task. Parameters are the variables that are called from the main body of the program to be used in a subroutine. They are written in brackets.

#21
Front (Question)

Define an argument

Back (Answer)

Arguments are the value of a parameter

#22
Front (Question)

Describe parameter passing by value

Back (Answer)

When a parameter is passed by value, it is effectively treated as a ​local variable​; a ​copy of the value​ ​is passed to the subroutine and discarded at the end therefore its value outside of the subroutine will not be affected.

#23
Front (Question)

Describe parameter passing by reference

Back (Answer)

When a value is passed through a subroutine, the subroutine receives the memory location of where the data is stored, allowing it to be directly modified.

#24
Front (Question)

What are the benefits of parameter passing by value over passing by reference?

Back (Answer)

• The original value isn’t changed, allowing it to continue to be utilised. • Retaining the original data preserves data integrity, and prevents changes made to the parameter leading to side effects throughout the program • Suitable for small data structures • Enhances function reusability as the function doesn’t unexpectedly affect data • Easy to implement and understand, while passing by reference requires careful handling to prevent unintended changes