1.2.4 Types of Programming Language Flashcards
Define and give the benefits of the procedural programming paradigm
Relatively simple to learn for beginners
Applicable to a wide variety of problems.
Uses the programming constructs of sequence, branching, iteration, and recursion.
Uses modular techniques to split large programs into manageable chunks.
Define and give the benefits of the object-oriented programming paradigm
Uses features such as classes (methods and attributes), objects, encapsulation, polymorphism and inheritance
Can abstract details of implementation away from the user
Code/classes are reusable & programs are simpler to maintain.
Define and give an example of the declarative programming paradigm
Languages such as SQL
Uses statements that describe the problem to be solved, and the language implementation decides the best way of solving it.
Define the assembly/low-level programming paradigm
Languages such as Assembly Language
Uses Mnemonics to represent Opcodes
Mainly hardware oriented - Allows greater control of hardware.
Quicker/more efficient to translate.
Makes more efficient use of the CPU.
List the 11 mnemonics used in LMC
ADD
SUB
STA
LDA
BRA
BRP
BRZ
INP
OUT
HLT
DAT
Write the LMC code to take two inputs and output the biggest of them.
State the four addressing modes
Immediate
Direct
Indirect
Indexed
Describe the immediate addressing mode
LDA 12 – Loads 12 into the accumulator
The operand is the value to be used
Doesn’t look for the value in RAM as the value is in the instruction.
Describe the direct addressing mode
LDA 4 would load the contents of location 4
The operand holds the memory location of the value to be operated on.
Describe the indirect addressing mode
LDA 4 would load the address held in location 4 and then load the value in the address that was found using location 4. (Bounces around…)
Operand is the memory location holding a value representing the memory location to be used
Enables a larger range of addressable locations.
Describe the indexed addressing mode
Index register = 3 + LDA 4 - Would load the data at location 7
Operand is added to the contents of the ‘Index Register’ to get the memory location of the value needed.
Used to access an array whose elements are in successive memory locations.
Describe a class
A template defining methods and attributes, used to make objects.
Describe an object
An instance of a class is called an object and is created using a constructor (new)
Describe a method
The actions that can be performed by an object; for example, get a position on a game board.
Describe an attribute
Each object will have its own public or private attributes.
The attributes of a player in a game of Monopoly might include its PlayerID and money.