[Unit 1.2.4] Types of Programming Language Flashcards
software and software development
define “programming paradigm”
fundamental style or approach to programming.
what are the features of high level languages
independent of hardware
translated by compiler/interpreter
one statement = many machine code instruction
what are the features of low level languages
Assembly:
- translated using assembler
- one statement = one machine code
Machine code:
- executable binary code
- produced by compiler/interpreter/assembler
what are the two types of high level languages
imperative languages
declarative languages
define “imperative language”
describe how to achieve result with step by step instructions
focus on control flow
- procedural
- OOP
define “declarative language”
describe what result should be, without specifying steps
focus on logic and constraints to determine outcomes
- logic
- functional
- SQL
define procedural programming
paradigm, follows step by step instructions. tasks broke down into procedures that operate on data
what are the key features of procedural programming
- uses sequence, selection & iteration
- divided into functions/procedures
- follows top-down design
define “object oriented programming”
paradigm that models real world entities as objects containing data (attributes) & behaviour (methods)
what are the key features of object oriented programming
- encapsulation
- abstraction
- inheritance
- polymorphism
define “functional programming”
paradigm has no mutable data structures. uses mathematical expressions. same input will always result in same output
what are the key features of functional programming
- pure function, no side effects.
- higher order functions, functions can take other functions as arguments
- recursion
- immutability
what are the key features of logic programming
- facts and rules instead of procedures
- backtracking to search for solutions
- declarative statements not step-by-step instructions
define “logic programming”
paradigm based on formal logic. rules and facts define relationships. queries used to find solutions.
what are the (Dis)advantages of procedural programming
ad:
- easy to write and understand
Dis:
- not reusable
- hard to maintain large programs
what are the (Dis)advantages of object oriented programming
Ad:
- organises code well
- reusable
Dis:
-overkill for small tasks (code bloat)
- increased complexability
- complicated for beginners
what are the (Dis)advantages of functional programming
Ad:
- concise
- avoids side effects
Dis:
- Harder to read for beginners
what are the (Dis)advantages of Logic programming
Ad:
- express rules declaratively
Dis:
- less practical for numerical operations
why is OOP better than procedural
- modular and reusable
- maintainable
- security
- real-world mapping
- collaboration
what is the mnemonic for load in assembly language
LDA
- contents of memory location onto accumulator
what is the mnemonic for Store in assembly language
STA
- copy accumulator to memory
what is the mnemonic for Add in assembly language
ADD
- add contents of memory to accumulator
what is the mnemonic for subtract in assembly language
SUB
- subtract memory from accumulator
what is the mnemonic for input in assembly language
INP
- copy input box into accumulator
what is the mnemonic for output in assembly language
OUT
- display accumulator in output box
what is the mnemonic for Halt in assembly language
HLT
-stop executing program
what is the mnemonic for branch always in assembly language
BRA
- unconditional branch, jump instruction.
what is the mnemonic for branch if zero in assembly language
BRZ
- conditional branch, if accumulator value is 0, if not it continues
what is the mnemonic for branch if positive in assembly language
BRP
- conditional branch, if accumulator is 0 or positive, if not it continues
what is the mnemonic for Data location in assembly language
DAT
- assigns memory location to store value, gives identifier
- always declared at end of program
- will be allocated immediately after program