1.2.4 Types of Programming Language Flashcards

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

1.2.4 A)
What is a program paradigms

A

Are approaches to using a program language to solve problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

1.2.4 A)
Types of program paradigms

A

imperative and decleartive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

1.2.4 A)
What is imperative

A

Code clearly specify the action to be preformed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

1.2.4 A)
What is declarative

A

Focus on declaring the desired result. Details on how its obtained are abstracted from the user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

1.2.4 A)
Type of imperative

A

procedual - python
oop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

1.2.4 A)
Type of declaratuve

A

functional - reusing func
logic - quries to find problem - sql

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

1.2.4 B)
properites of procedual programming

A

Easy to implement ,not possible to solve all problems or maybe ineff

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

1.2.4 B)
Four main programming structure

A

Sequence - execute line by line top to bottom
Selection - Code is run if a specific condition is met
iteration - code is run a # of time or while condtion true
Recursion - Func are expression in terms of themselves until conditions is met known as base case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

1.2.4 B)
What is procedual programming suited for

A

is suited to probelsm that can be easly be expressed as a series of instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

1.2.4 C)
What is assembly language

A

Next level up from machine code low level language converted to machine code using an assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

1.2.4 C)
explain LLL

A

language based on instruction set of the computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

1.2.4 C)
How does AL use mnemonics

A

uses mnemonics rather then binary easier to use than direct machine code. Mnemoics represent numeric code
Processor specific as it directly interacts with cpu purpose register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

1.2.4 C)
What is Assembly language used for and why

A

useful for embedded ssytems as allows for direct interactions with hardware

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

1.2.4 C)
Mnemocs > instructions > functions

A

AS SLIO HD BBB
ADD > add > adds values @ memory and acc
SUB > subtract > sub value @ memory from acc
STA > store > Value at acc at address
LDA > load > value at mm to acc
INP > input > user input stored to acc
OUT > output > print value at acc
HLT > halt > stops execution
DAT > data > flag w/ label with data is stored
BRZ > branch if 0 > *BR is zero *CB
BRP > branch if + > *BR is positive *CB
BRA > branch always > branch to given address no matter of acc value, uncoditonal branch

*BR = branch to given address if acc value
CB - conditonal branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

1.2.4 D)
What two components make up machine code instructions

A

opcode and operand

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

1.2.4 D)
What is the opcode

A

Holds the specific instructions to be preformed

17
Q

1.2.4 D)
What is the operand

A

holds the value releated to data on which is instruction is run

18
Q

1.2.4 D)
Whats the advantage of using addressing mode
Whats the disadvantages of using addressing modes

A

Requires less code: operand address is directly specified in the instruction, Less complex: requires fewer instructions and is generally easier to debug

it is not useful for accessing complex data structures such as arrays and records that are used in high-level languages

19
Q

1.2.4 D)
Types of addressing modes

A

immediate addressing
Direct addressing
Indirect addressing
indexing addressing

20
Q

1.2.4 D)
Explain immediate addressing

A

The operand is the value which the instruction uses

21
Q

1.2.4 D)
Explain direct addressing

A

operand gives the address which holds the value

22
Q

1.2.4 D)
Explain indirect addressing

A

operand gives the address of a register which holds another address where the data is held

23
Q

1.2.4 D)
Explain indexed addressing

A

index register used stores value address of operand determind by adding operand This is
necessary to add an offset in order to access data stored contiguously in mmemory such as in arrays

24
Q

1.2.4 E)
Objective of oop

A

attempts to capture or group infomation / data and code into structed items known as objects

25
Q

1.2.4 E)
what is an object

A

an object is an instance of a class
object could be anything like a car or a data structure.
Objects interact with eachother through sending and revecing messages

26
Q

1.2.4 E)
properties of a class

A

class name
attributes
data types
methods

27
Q

1.2.4 E)
What a class

A

A template (1) defining methods and attributes (1)
used to make objects (1).

28
Q

1.2.4 E)
What are the two main methods

A

setters and getter
setx() , getx()

29
Q

1.2.4 E)
What is inheritance and when is it used

A

sub classes share attributed and methods from superclass.
inheritance is used to share methods and attributes so sub class can add on more attributes and methods for more specialised objects. Makes code reuseable more eff.

Inheritance is when a class takes on the methods (1)
and attributes (1) of a parent class (1).

30
Q

1.2.4 E)
Properties of class diagram

A

super/base/parent class , sub/derived class. Arrows point up to class it inheritance from. (inheritates methods + attributed)

31
Q

1.2.4 E)
What is overriding

A

occurs automatically when you call a methid from an object that shares the name with method futher up the class tree. For example having getname() in super class and sub, sub overridies and is used. However using super.getname() will get the name from the superclass

32
Q

1.2.4 E)
What is encapsulation

A

The bundling of data with the methods that operate on and restrict direct access to it

33
Q

1.2.4 E)
What is encapsulation used for

A

to hide the values or internal state of an object preventing direct access by unauthorised parties.
Encapsulated attributes should only be access through method. Makes sure no accidental changes

34
Q

1.2.4 E)
What is polymorphism

A

Polymorphism is a property of OOP that means objects can behave differently depending
on their class.

35
Q

1.2.4 E)
Properties and types of polymorphism

A

the same method producing different outputs depending on the object involved. There are two categories of polymorphism: overriding and
overloading.

36
Q

1.2.4 E)
What is overriding in terms in polymorpism (same as in inheritance)

A

Overriding(dynamic) is redefining a method within a subclass and altering the code so that it functions differently and produces a different output

37
Q

1.2.4 E)
What is overloading in terms in polymorpism

A

Overloading (static) is passing in different parameters into a method. Both of these forms of
polymorphism would produce different results which would depend on the scenario.

38
Q

1.2.4 E)
Advantages of OOP

A
  • High level of reuseability (inheritance + polymorphism)
  • classes can be used in multiple projects
  • encapsulation makes code reliable by protecting attributes
  • advance planning can lead to ^ quality code and fewer vunrabilities
  • modular structure easiler to maintain and update
  • high level of abstraction. testing . blackbox reuse
39
Q

1.2.4 E)
Disadvantages of OOP

A
  • Diff style may be hard to pick up
  • not suitable for all problems. may be longer and ineff
  • unsuitable for smaller problems