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)

Programming constructs

Back (Answer)

• a programming construct determine the order in which lines of code are executed • 3 main programming constructs • selection • iteration • sequencing

#2
Front (Question)

Sequence

Back (Answer)

• code is executed line by line in sequence from top to bottom

#3
Front (Question)

Iteration

Back (Answer)

• repeating a line or block of code using a loop • can either be count controlled or condition controlled

#4
Front (Question)

Count controlled

Back (Answer)

• (for loop) • is used when the number of iterations is known before execution and the block of code is executed a certain number of times

#5
Front (Question)

Condition controlled

Back (Answer)

• used when the number of iterations is not known so the block of code is only executed while a condition is met • while loop, do until loop

#6
Front (Question)

Branching

Back (Answer)

• the particular block of code is run if a specific condition is met • eg. If else statements

#7
Front (Question)

Recursion

Back (Answer)

• is when a subroutine/function calls itself from within its own subroutine/function [1] • the function continues to call itself until a base case/stopping condition is met [1]

#8
Front (Question)

Importance of base case

Back (Answer)

• without a base case, a recursive function may call itself indefinitely resulting in a stack overflow • the base case should be reachable within a finite number of times • for input values other than the stopping condition, the function must call itself

#9
Front (Question)

Recursion benefits

Back (Answer)

• quicker to write/ requires less lines of code [1] as some functions are naturally recursive • can reduce the size of a problem with each call [1] • recursion is suited to certain problems e.g problems involving trees or factorials [1]

#10
Front (Question)

Recursion drawbacks

Back (Answer)

• more difficult to trace as each frame on the stack has its own set of variables [1] • requires more memory compared to the equivalent iterative algorithm in order to maintain the stack of calls [1] • risk of stack overflow if memory runs out e.g due to too many calls [1]

#11
Front (Question)

Scope

Back (Answer)

• the section of code in which a variable can be accessed • a local variable within a subroutine takes precedence over a global variable with the same name

#12
Front (Question)

Local variables

Back (Answer)

• can only be accessed with the subroutine in which they were defined [1] • multiple local variables with the same name can exist in different subroutines [1]/ same variable name be used in other modules without causing errors/overwriting • are deleted once the subroutine ends [1] • can overwrite global variables with the same name [1]

#13
Front (Question)

Global variables

Back (Answer)

• can be accessed across the whole program [1] (so no need to pass as a parameter or redeclare • is used when a value needs to be accessible from various parts of a program [1] • value remains the same irrespective of where it is accessed [1] • e.g values of constants like pi or VAT rate [1] • not deleted until the program terminates so requires more memory

#14
Front (Question)

Global variables drawbacks

Back (Answer)

• make it difficult to integrate modules [1] • increase the complexity of a program [1] • they may cause conflicts with names in other modules [1] • may be modified unintentionally when the program is complex [1]

#15
Front (Question)

Modular programming

Back (Answer)

• programs are split into separate self contained modules [1] • which can be written/tested individually [1] • modules can be subdivided further into smaller modules [1]

#16
Front (Question)

Modular programming advantages

Back (Answer)

• modules can be reused in the current project and future projects which saves time [1] • modules can be shared between programmers so work is easier to divide between a team [1] • this reduces development time as work takes place in parallel [1] • modules can be allocated according to the programmers/team members expertise [1] • modules are easier to maintain/test/debug as each subroutine can be tested independently before integration [1]

#17
Front (Question)

Function

Back (Answer)

• a named block of code that performs a specific task and must always return a single value [1]

#18
Front (Question)

Procedure

Back (Answer)

• a named block of code that performs a specific task but does not have to return a value [1]

#19
Front (Question)

Parameter

Back (Answer)

• an item of data that is passed into a subroutine and can be discarded at the end of the subroutine [1]

#20
Front (Question)

Parameter passing

Back (Answer)

• by value • by reference

#21
Front (Question)

Passing by Value

Back (Answer)

• a local copy of the value/data is passed into the subroutine and discarded at the end of the subroutine [1] • so only the copy is changed [1] • this means value of the original data is unchanged/remains unaffected [1]

#22
Front (Question)

Passing by Reference

Back (Answer)

• the address/memory location of the data is sent [1] • so changes are made to the original data/changes the value in the variable passed [1] • changes remain even after the subroutine exits [1]

#23
Front (Question)

IDE ( integrated development environment)

Back (Answer)

a program used for developing programs which provides a set of tools to make it easier for programmers to write, develop and debug code [1]

#24
Front (Question)

IDE features

Back (Answer)

• Stepping • break points • error diagnostics • variable watch window • syntax highlighting • autocomplete