1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is sequencing?
Code is executed line-by-line, from top to bottom.
What is Branching/Selection?
A certain block of code is run if a specific condition is met, using IF statements.
What is Iteration?
A block of code is executed a certain number of times or while a condition is met. Iteration uses FOR (Count-controlled), WHILE (Condition-controlled) or REPEAT UNTIL loops.
What is recursion?
a programming construct in which a subroutine calls itself during its execution. This continues until the stopping condition is met.
What is a Call stack?
a stack data structure that stores information about the active subroutines of a computer program.
What is a Stack Frame?
Stack frames are used by computers to store return addresses, parameters and local variables for each subroutine call that occurs during the execution of a program.
This information allows the subroutine to return to that particular point during its execution.
Disadvantages of recursion?
● Inefficient use of memory; If the subroutine calls itself too many times, there is a danger of a stack overflow (call stack runs out of memory).
● Difficult to trace, especially with more and more function calls.
What is a more efficient form of recursion called?
Tail recursion is a form of recursion which is implemented in a more efficient way in which less stack space is required.
What is the Scope of a variable?
It defines where the variable can be used in a program.
Local vs Global Scope
●Local variables have limited scope which means that they can only be accessed within the block of code in which they were defined. E.g. if defined in a subroutine can only be used in the subroutine.
●Global variables, on the other hand, can be accessed across the whole program. All variables used in the main body of a program are automatically declared to be global.
Advantages and Disadvantages of Local Scope
●Advantages
Ensures subroutines are self-contained, with no danger of variables being affected by code outside of the subroutine.
●Allows variables with the same name to exist (as long as they are in different subroutines).
Disadvantages
●It can only be accessed within its Scope
Advantages and Disadvantages of Global Scope
Advantages
●Useful for values that need to be used by multiple parts of the program.
Disadvantages
●Require more memory as not deleted until end of program.
●Can be unintentionally overwritten.
●Local variables take precedence over Global variables.
Difference between byVal and ByRef
●ByVal means that you are passing a copy of a variable to your Subroutine. You can make changes to the copy and the original will not be altered. The copy is discarded at the end.
●ByRef means the address of the given parameter is passed into the subroutine and the value at the location will be updated.
Difference between function and procedure
●Procedures do not have to return a value (hence void)
●Functions must always return a value
Define Stepwise Refinement
A Technique used to modularise programs; The problem is broken down into sub-problems until each module preforms a certain task.
What is an IDE (Integrated Development Environment)?
Program which provides a set of tools to make it easier for programmers to write, develop and debug code.
Name features of an IDE
●Stepping-This allows you to monitor the effect of each individual line of code by executing a single line at a time.
●Variable Watch-observe how the contents of a variable change in real-time through the execution of a program.
●Breakpoint-o set a point in the program at which the program will stop. This can either be based on a condition or set to occur at a specific line. This can help to pinpoint where an error is occurring.
●Source code Editor-Provides features such as: autocompletion of words, Indentation, syntax highlighting and automatic bracket completion.
●Debugging tools- Run-time detection of errors; stating the lines errors are found and highlighting them.
Uses of OOP
●Encapsulation
●Reusability (Using Classes, Inheritance and Polymorphism)