2.2.1 Programming Techniques(uncomplete) Flashcards
Name 3 programming constructs
-sequence
-selection
-iteration
which two categories of loop is iteration split into
-count controlled loop
-condition controlled loop
describe how the branching programming construct work
A certain block of code is run if a specific condition is met, using IF statements
what is recursion
a programming construct in which a subroutine calls on itself during its execution until the stopping condition is met
what is the base case in recursion
A condition that must be met in order for the recursion to end
state two advantages of recursion
- can be represented in fewer lines of code
-Easier to express some functions recursively than using iteration
state a disadvantage of recursion
-inefficient use of memory
-danger of stack overflow from it calling itself repeatedly which would cause the call stack to run out of memory this would cause the program to crash
-difficult to trace
give two pieces of information that are stored on the call stack
-parameters
-return addresses
-local variables
define scope
the section of the program in which a variable is accessible
give two advantages of using local variables over global variables
-less memory is used
-self contained so unaffected by code outside of the subroutine
- take procedure over global variables with the same name
what is top down design
A technique used to modularize programs in which the problem is continually broken down into sub problems, until each can be represented as an individual, self-contained module which can preforms a certain tasks
state two advantages of a modular design
-makes a problem easier to understand and approach
-simpler to divide tasks between a team
-easier to manage project
-self contained modules simplify testing and maintenance
-greater reusability
what is the difference between procedures and functions
Functions must always return a value while a procedure does not always have to return a value
what does it mean to pass a parameter to a subroutine by reference
the address in memory of the parameter is passed to the subroutine so its value outside of the subroutine will be updated
state 2 features of an IDE
-stepping
-variable watch
-breakpoint
-source code editors
-debugging tools