Save
...
OCR Comp Sci
Paper 2
Topic 2
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Connor McKeown
Visit profile
Cards (89)
What is the purpose of simplifying a problem in programming?
To represent it in an
understandable
way
View source
What is the first construct used in structured programming?
Sequence
View source
How is code executed in a sequence construct?
Line-by-line from
top to bottom
View source
What is the purpose of branching in programming?
To run code if a
condition
is met
View source
What is another term for branching?
Selection
View source
What does iteration allow in programming?
To execute code
multiple
times
View source
What types of loops are used in iteration?
FOR
,
WHILE
, REPEAT UNTIL
View source
What is count-controlled iteration?
Iteration repeated a
specific
number of times
View source
How would you write a count-controlled loop in Python?
for i in
range
(0,10):
View source
What is condition-controlled iteration?
Iteration
continues
until
a
condition
is
met
View source
How would you write a condition-controlled loop in pseudocode?
while
i <=
20
:
View source
What is recursion in programming?
A
subroutine
calls itself during execution
View source
What is the stopping condition in recursion?
The
condition
at which recursion stops
View source
How does recursion compare to iteration?
Produces the same result but is different
View source
What is an advantage of using recursion?
Fewer
lines of code
, less prone to
errors
View source
Why is it essential to define recursive subroutines clearly?
To reach a
stopping condition
after
finite calls
View source
What is a common example of a recursive function?
Factorial
function
View source
What happens each time a recursive function calls itself?
A new
stack frame
is created
View source
What is stored in a stack frame?
Parameters
,
local variables
,
return addresses
View source
What does it mean for a subroutine to unwind?
Information is popped off the
call stack
View source
What is a disadvantage of recursion?
Inefficient
use of memory
View source
What is a stack overflow?
When the
call stack
runs out of memory
View source
What is tail recursion?
A more
efficient
form of recursion
View source
Why is recursion difficult to trace?
Due to multiple
function calls
View source
What does scope refer to in programming?
The section of code where a
variable
is available
View source
What are local variables?
Variables accessible only within their
block
View source
Why are local variables considered good practice?
They ensure
subroutines
are self-contained
View source
What are global variables?
Variables accessible across the whole
program
View source
What is a disadvantage of global variables?
They can be
unintentionally
overwritten
View source
What happens if a local variable has the same name as a global variable?
The local variable takes
precedence
View source
What is modular programming?
A technique to split programs into
modules
View source
What is the benefit of modular design?
Makes
problems
easier to understand and manage
View source
What is the top-down approach in programming?
Breaking down problems into
sub-problems
View source
What is stepwise refinement?
Breaking down problems into smaller
tasks
View source
What are subroutines?
Named
blocks
of code performing specific tasks
View source
What is the difference between procedures and functions?
Functions must
return
a value, procedures do not
View source
How can procedures return values?
They can return
multiple
values
View source
What is an example of a function?
Function
isEven
(number) returns
True
or
False
View source
What happens when parameters are passed by value?
A
copy
of the value is passed
View source
What does passing by reference mean?
The address of the
parameter
is given
View source
See all 89 cards