Problem solving and programming 2.2 Flashcards
Name the three programming constructs
- Sequence
- Selection
- Iteration
What is sequence?
Sequence is the order in which instructions occur and are proccessed
What does selection do?
Selection determines which path the program takes
What is iteration?
iteration is the repeated excecution of a section of code when a program is running
Which two categories of loop are iteration split up into?
- Count controlled(for loop)
- Condition controlled(while loop)
What is recursion?
Where a subroutine call itself during excecution until the stopping condtion is met
State two advantages of recusion
- Can be represented in fewer lines of code
2.Easier to express some functions recursively than using iteration
State two disadvatages of recursion
- Inefficent use of memory
2.Difficult to trace - Danger of stack overflow
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
2.Take priority over global variables with the same name - uneffected by code outside of the subroutine
What is the difference between a procedure and a function?
Functions must always return a single value, while procedures do not always need to return a value
What does it mean to pass in a parameter (to a subroutine) by reference?
The address in memory of the parameter is passed to the subroutine so the value outside the subroutine will be updated
The value in the parameter is changed
What does it mean to pass in a parameter (to a subroutine) by value?
The value stored inside memory location is passed into the function
The variable outside the function does not change
What are IDE’s?
Integrated development environment is a software application that provides a comprehensive set of tools. They are useful tools for software developers
What does IDE stand for?
Integrated Development enviornment