A level Flashcards
Describe Procedural Programming.
- Specific step-by-step code written telling computer what to do with an input.
- Used commonly in educational environments
- Code is easy to follow
- Structural programming is an example and uses concepts such as recursion, iteration, sequence and selection.
- Built-in data types (int, float, real)
- Typically has a data structure but the use of the DB needs to be coded therefore OOP better
Describe Object orientated programming.
- Uses class which what the data look like and how it should behave.
- Data items called objects
- Abstracts details of implementation away from programmer
- Makes code reusable
- Uses inheritance and polymorphism
Describe Declarative programming.
A statement describing the problem is written and the language implementation describes the best way to solve it.
Describe functional programming.
Functions are used to solve a problem.
What is a class?
A class is a template for a set of objects which have a state and behaviour.
What is an object?
An instance of a class.
- A real world entity
- Holds attributes and methods
What is an attribute?
An attribute describes an individual data item within an entity.
What is a method?
A method is a procedure associated with the object.
What is inheritance?
The ability for a class to be able to inherit properties and methods of another class.
What is encapsulation?
Attributes of an object can only be accessed using class methods.
This ensures that when a class is coded and tested it will not be a cause for future problems.
What are the advantages of OOP?
- Requires extensive planning ensuring better design and fewer weaknesses.
- Encapsulation allows independent testing of source code of object.
- Methods of object do not need to be understood to be used. (Polymorphism)
- New objects can be easily created
- Reusability
- Libraries of code available
- Easier to maintain.
What is Immediate Addressing?
The actual value to be loaded into accumulator (operated on).
What is Direct Addressing?
The memory address of the value to be operated on is held.
What is Indirect Addressing?
The address of the address of the data is held.
What is Index Addressing?
The value of index register and register indexed added together to give location of value.
What happens during Lexical analysis?
- White space and comments removed
- Tokens of reserved words, constants, operators and variables.
What happens during syntax analysis?
- Tokens are put together to check that valid sentence is formed
- Dictionary of variables generated containing location of variables
- Identifiers checked against a set of rules
- Semantic analysis (logical errors)
- Produces abstract binary syntax tree
What happens during Code generation?
- High level instruction converted into machine code