Unit 11 Programming Techniques Flashcards
What is an IDE?
Integrated Development Environment
A software which enables you to enter, edit, compile, interpret and run your programs
How can an IDE make entering program code as easy and quick as possible? (4)
- Add line numbers
- Automatically indent code
- Auto-complete commands
- Comment or un-comment a region
What is an Algorithm?
A sequence of instructions that can be followed to solve a problem
What is Pseudocode?
A type of instructions that are somewhere between English and a programming language
What is an Identifier?
A name that points to memory location
What is Assignment?
Assigning a value to the memory location
What is the difference between a Variable and a Constant?
A variable can be changed a constant can’t
Why would someone use a Constant instead of a Variable?
Reduces the risk of errors by reducing access to the memory location
What does MOD do?
Outputs the remainder after dividing 2 numbers
What does DIV do?
Outputs the integer answer after dividing 2 numbers
What does a Boolean Condition evaluate to?
True or Flase
What does AND do?
Returns TRUE if both conditions are true
What does OR do?
Returns TRUE if either of the conditions is true
What does NOT do?
A TRUE expression becomes FALSE and vice versa
What is Iteration?
Repetition of sections of code. There are 3 types of loop: While, Do and For
What is a Subroutine?
A set of instructions with a name. Program flow will ‘jump’ to that subroutine when called. When the subroutine has finished, the program will continue from where it was called
What is a Library Subroutine?
A subroutine that comes pre-defined with the programming language
How do you pass data to a Subroutine?
Put arguments in parentheses after calling the subroutine
Why is the order of the parameters in the parentheses in the Subroutine important?
Each parameter order corresponds to a different variable in the subroutine
How can a Function return a value?
Using a return statement
What’s the difference between a Local and Global Variable?
A local variable is contained in a subroutine and can only be used, referenced or changed in that subroutine. A global variable is defined in the main program and can be used in any subroutine called from the main program
What are the advantages of a Local Variable? (2)
- The subroutines will be independent of a particular program and can be re-used in different programs
- There is no chance of accidentally changing a variable in the main program that is used in a subroutine or vice versa
What is Modular Programming?
Where a major task is broken down into smaller subtasks that may be further broken down until each ‘module’ performs a single function
What are the advantages of Modular Programming? (4)
- Large programs are broken down into subtasks that are easier to program and manage
- Each module can be individually tested
- Modules can be re-used several times in a program
- Large programs are much easier to debug and maintain