1. 2. 4 Types of Programming Language Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Programming Paradigms

A
  • This is different approaches to using a programming language to solve a problem
  • Two broad categories, imperative and declarative
  • Imperative includes procedural and object-oriented paradigms
  • Declarative split into logic and functional paradigms
  • Paradigm used depends on type of problem that needs solving
  • Image gives Visual representation in Word Document
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Imperative

A
  • Imperative programming paradigms use code that clearly specifies the actions to be performed
  • Procedural and Object-oriented paradigms are included
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Procedural

A
  • Applied to a wide range of problems, relatively easy to write and interpret
  • Type of imperative programming which uses a sequence of instructions (may be contained within procedures)
  • Instructions carried out step by step
  • Examples- Pascal, Python, Logo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Object-Oriented

A
  • Applicable to certain types of problem with lots of reusable components which have similar characteristics
  • OOP built on objects formed from classes which have certain attributes and methods
  • OOP focuses on making programs that are reusable and easy to update and maintain
  • Examples- Python, Delphi, Java
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Declarative

A
  • Focuses on stating desired result rather than exact instructions to get result
  • Role of programming language to determine how best to obtain result
  • Details about how result is obtained is abstracted from the user
  • This type of programming common in expert systems and AI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Functional

A
  • Programming that uses the concept of reusing a set of functions that form the core program
  • Programs made up of lines of code consisting of function calls
  • Function is a named block of code that does a specific task, returns a value
  • This type of programming closely linked to maths
  • Examples- Haskell, C#, Java
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Logic

A
  • Logic languages part of declarative programming paradigm
  • Use code which defines a set of facts and rules based on the problem
  • Queries used to find answers to problems
  • Examples- Prolog
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Procedural Language

A
  • Used for wide range of software development because it is simple to implement
  • Not possible to solve all kinds of problems, may be inefficient to use this
  • Procedural languages use traditional data types (integers, strings etc), built into language
  • Also provides data structures such as dictionaries and arrays
  • Structure programming subsection of procedural programming
  • Control flow given by 4 main programming structures
  • Sequence (ran line by line), Selection (run if specific condition met), Iteration (loop certain number of times or while condition met), Recursion
  • Recursion, functions expressed in terms of itself, calls itself till condition known as base case (does not call function) is met
  • Procedural programming suited to problems that can easily be expressed as series of instructions using constructs described above
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Assembly Language (Little Man Computer)

A
  • Next level up from machine code, low level language
  • Translated into machine code using assembler when it is executed
  • Uses mnemonics, makes it easier to use than machine code
  • Each mnemonic represented by numeric code
  • Commands used are processor specific due to it having direct interactions with the CPUs registers
  • Allows for direct interaction with hardware, therefore useful in embedded systems
  • One instruction of assembly code typically equivalent to one line of machine code
  • Instructions shown in Word Document
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Modes of Addressing Memory

A
  • Machine code instructions made up of two parts, opcode and operand
  • Opcode specifies instruction to be performed from table above
  • Operand holds value which is related to data which instruction is to be performed
  • Addressing modes allow greater number of locations for data to be stored
  • Size of operand would otherwise constrain number of addresses that could be accessed
  • Addressing mode specifies how operand should be interpreted, it is a part of the opcode
  • Four addressing modes, Direct, Indirect, Immediate and Indexed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The Modes of Addressing

A
  • Immediate addressing is when the operand is the actual value to be operated on, represented by binary
  • Direct addressing is when the operand holds a memory address which holds the value to be operated on, this is used in LMC
  • Indirect addressing is when the operand gives the address of a register which has another address where the data is located
  • Indexed addressing is when an index register is used which stores a certain value, address of operand determined by adding operand to index register
  • Necessary to add an offset (integer indicating distance from beginning of object to a given element or point) to access data stored contiguously (in contact, touching) in memory such as arrays
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Classes, Objects, Methods & Attributes

A
  • Class- blueprint of Object, defines state and behaviour of object
  • State given by Attributes- Variables give object properties
  • Behaviour defined by Methods associated with class- Describe actions it can perform
  • Object instance of a class, class used create multiple objects same attributes and methods (Instantiation)
  • Setter sets value of particular attribute
  • Getter retrieves value of given attribute
  • Ensure attributes cannot be directly accessed and edited (Encapsulation)
  • Can only be altered by public methods
  • Constructor method- allows new object to be created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Inheritance and Polymorphism

A
  • Inheritance process sub class inherits all of the methods and attributes of the super class
  • Parent class, Child class Child class can have its own additional properties
  • Polymorphism enables objects to behave differently depending on their class, lead to same method producing different outputs, Two categories below
  • Overloading- Pass different parameters / variables into a method
  • Overriding- Redefine method functions differently produces different output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Advantages & Disadvantages OOP

A
  • Advantages- High level of reusability. Code made more reliable through encapsulation, makes code easy to maintain and update, classes can be reused save time and effort
  • Disadvantages- Requires alternative style of thinking, not suited to all types of problems, unsuitable for smaller problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly