Types of Programming Language Flashcards
what is a paradigm
a way of looking / thinking about something
- a standard
- a certain perspective
- a set of ideas
A new paradigm in business could mean a new way of reaching customers and making money
what is a programming paradigm
a certain approach we might have to programming
Which assembly language mnemonic is used to branch if the accumulator is greater than or equal to zero?
BRP
Which assembly language command will always change the value in the program counter?
BRA
Which assembly language mnemonic is used to subtract a variable from the accumulator?
SUB
Which of these is a feature of object orientated programming languages?
Select the most appropriate answer.
Programs are structured into procedures and/or functions
Uses symbolic address as labels to reference locations of data in memory
Commands have a one-to-one relationship with machine code
Programs are structured into classes, methods and instances
Programs are structured into classes, methods and instances
What keyword should be placed before an attribute or method in pseudocode if we want to make sure it can be accessed by other objects?
PUBLIC
Which of these is a feature of a low level programming language?
Select the most appropriate answer.
Source code is easier to write
Large number of instructions
Translates to many different machine types
Source code is harder to write
Source code is harder to write
What does this line of object orientated pseudo-code do?
CLASS teacher INHERITS Person
Creates a new subclass called teacher which inherits from the person class
Which is the correct definition of ‘direct addressing’?
Select the most appropriate answer.
The operand is an address to a memory location containing an address
The address is the base address plus the value in the index register
The operand is a value to be used by the instruction
The operand is the address to use by the instruction
the operand is the address to use by the instruction
indexed addressing
modifies the address by the addition of a number held in the index register
object
an instance of class
subclass
a class that extends another class. the subclass inherits the methods and attributes of the class it extends
method
a subroutine contained within a class / object designed to perform a particular task on the data within the object
superclass
a class that has been extended by another class
attribute
a single item of data within a record or object
define low level language (2 marks)
a language which is close to machine code
one mnemonic translates to one machine code instruction
a language that is most suited to the machine architecture
state three advantages of programs written in Assembly language (3 marks)
one to one relationship with machine code
can make use of special machine-dependent instructions
e.g. in the instruction set for the chip
translated program requires less memory
code can execute more quickly
easier to optimise
can work directly on memory locations
explain inheritance
a class has all the attributes and operations/methods …
…of its superclass…
…and may also have attributes and operations/methods of its own
class
a class is a type definition
a class has attributes and methods
A product manager at ‘Better Solutions Ltd’ oversees a team of developers who program in both high-level and low-level languages.
Justify why the team may sometimes choose to write programs in either a high-level or low-level language. (6 marks)
high-level language
- easier to learn / understand code …
- programs can often be developed faster
- programs are prone to less errors / bugs
- programs are easier to debug / maintain / improve
- easier to find programmers who specialise in high-level language
- some high-level languages are specifically designed to solve certain types of problems
low-level language
- code is optimised for a specific architecture
- code can execute extremely fast
- the assembled code occupies less space in the memory than the machine code equivalent produced by a high level complier
- individual statements are able to manipulate / control specific hardware components
types of programming paradigms
object-oriented programming (OOP)
imperative programming
declarative programming
procedural programming
where do all these paradigms come from
high level language
assembly language
machine code
low-level vs high-level languages diagram
HLL OO & visual languages
HLL HL language: C, Fortran, Pascal
LLL assembly language
LLL machine language
LLL hardware
high level language
uses more human readable statements and constructs
each line of code will translate to multiple lines of machine code
uses an assembler or complier to translate into machine code
much more complex and further abstracted from machine code
assembly language
uses short codes called mnemonics e.g. ADD, R1, R2 or INP X
for each mnemonic there is one sequence of 1s and 0s
they are slightly more abstracted and easier to read / write
an assembler is used to translate from assembly language to machine code
machine code
we use 1s and 0s to represent the electrical signals within the computer
it’s the closest to what is happening on the computer which makes it the least abstract
types of high level languages
imperative
- focus is on describing how a program operates
- made up of statements that will change the programs state using sequence, selection and iteration
declarative
- focuses on WHAT the program should accomplish