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
What are the essential characteristics of a Recursive Routine? (3)
- A stopping condition or base case must be included
- For input values other than the stopping condition, the routine must call itself
- The stopping condition must be reached after a finite number of calls
What is the Fibonacci Sequence?
Where each number is found by adding the two preceding numbers
In OOP what does a class do?
Defines what an object in the class will look like (its properties), and what it can do (its methods). Its the blueprint for an object
In OOP what is an Attribute?
A property of an object
In OOP what is a Method?
The procedures that an object can perform
Are Attributes normally defined as public or private?
Private
Are Methods normally declared as public or private?
Public
What does Encapsulation do?
Wraps the attributes and methods in the class definition, hiding details of the implementation from the user
What is a Constructor?
A method used to create a new object in a class
What is Instantiation?
Creating an instance of an object
What is Polymorphism?
The ability of a programming language to process objects differently depending on their class
What are the advantages of OOP? (4)
- Classes can easily be saved in a library and reused in other programs
- Encapsulation reduces code complexity
- Attributes can be hidden from users so that they cannot change them accidentally
- Easier to modify and maintain