1.2.4 Types of Programming Languages Flashcards

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

What is a programming paradigm?

A

A style or a way of programming.

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

What is machine code?

A
  • The least abstract - closest to what happens on a computer
  • Directly into binary
  • These translate into matching electrical signals
  • One to one relationship
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are high-level programming languages?

A

Types of programming languages that are more closer to natural language, making it easier for humans to understand.

They have a many-to-one relationship, as each instruction of code is equivalent to many lines of machine code. Thus they are more complex.

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

What are low-level programming languages?

A

Types of programming languages that provide little or no abstraction from the machine instructions, allowing programmers to manipulate hardware elements (register, memory etc).

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

What are the types two types of low-level programming languages?

A
  • Machine code
  • Assembly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is assembly?

A
  • Uses mnemonics (match to a specific of 1s and 0s)
  • One to one relationship
  • Written in assembly language and translated by a specific assembler
  • Uses symbolic addressing as labels to reference data locations
  • Data is accessible to other parts of the program using parameter passing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the advantages of low-level languages?

A
  • Assembly and machine have the same efficiency through 1-1 nature
  • Very precise, locally optimised and efficient code
  • You are in complete control of the code
  • Provides access to system level features without going through system interface, improving program speed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the disadvantages of low-level languages?

A
  • Machine-dependent and code is very hard to port
  • Programmers to write efficient assembly code are rare
  • Even for a talented programmer, code is tedious to write and very prone to bugs
  • Code can be difficult to understand, so it’s hard to modify and maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two categories of high-level languages?

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

What are declarative languages?

A

They focus on what a program is required to do, but not how they do it.

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

What are imperative languages?

A

They use statements that change the program’s state in the form of sequence, selection and iteration. They consist of commands for a computer to perform and focus on describing how a program operates.

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

What are the features of a procedural language?

A
  • Sequence, selection and iteration
  • Data stored in local/global variables
  • Data accessible by addressing specific memory locations
  • Structured into procedures and functions
  • Logic is expressed in a series of procedure calls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the features of an object-oriented language?

A
  • SSI + inheritance, objects, classes and encapsulation
  • Data stored in attributes
  • Data concealed from other parts of the program via encapsulation
  • Programs structured into classes, methods and instances (objects)
  • Logic is based on models and behaviours
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a procedural (imperative) language?

A

One of the most common programming paradigms in use. They focus on telling a computer exactly what to do by sequential instructions.

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

What is a local variable?

A

A variable that can only be accessed within the specific subroutine it was declared in.

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

What is a global variable?

A

A variable that cab be accessed throughout the entire program and is used by all modules during execution.

17
Q

What is parameter passing?

A

Allows variables values to be passed into subroutines for use in these blocks of code.

18
Q

What is modularity?

A

The concept of separating the functionality of a program into small, interchangeable blocks - each designed to carry out a specific task.

These all combine to make a complete program and make the program more readable.

19
Q

What is a library?

A

A collection of pre-built functions and procedures that can be linked and used by a programmer in their own code.

20
Q

What is immediate addressing (immediate operand)?

A

The actual value (immediate data) is specified in the operand rather than referring to the content of a memory address or a register.

21
Q

What is direct addressing?

A

The value of the operand is a reference to the address in memory where the contents are loaded into the accumulator.

22
Q

What is indirect addressing?

A

The operand, or the data to be manipulated, is not directly specified in the instruction.

Instead, the instruction contains a reference to the memory address that holds the actual operand.

23
Q

What is index addressing?

A

The operand, or the data to be manipulated, is located at an address calculated by adding a constant offset (index) to a base address.

24
Q

Why do we need different types of addressing?

A

Various addressing modes allows programmers to tailor their instructions to the specific needs of a program, enhancing versatility, efficiency, and overall performance.

25
Q

What is an index register?

A

An index register is a register that holds a value representing a memory address.
This is used to find specific items in data structure (arrays).

26
Q

Why is an index register used in indexed addressing?

A

Instead of looking through the entire list one by one, the computer can use the index register to jump directly to the address of the first item of the array, increasing efficiency and speed when accessing required data.

27
Q

What is the OPCODE?

A

A specific binary value that represents a single instruction from the processor’s instruction set.​

28
Q

What is the OPERAND?

A

Represents the data to be operated on or manipulated by some type of operator.​

29
Q

What is object-oriented programming?

A

A paradigm, involving the attempt to capture or group information, data and related functionality into structure items known as objects.​

30
Q

What is a class?

A

A template for creating objects. It defines the attributes and behaviors that the instantiated objects will have.

31
Q

What is a superclass (base class)?

A

The class from which a subclass inherits its attributes and behaviours.

It is higher in the class hierarchy and provides a common set of features that multiple subclasses can share.

32
Q

What is an object?

A

An instance of a class which represents a real-world entity, combining data (attributes) and the actions (methods) that can be performed on that data.

33
Q

What is inheritance?

A

A mechanism that allows a new class (subclass or derived class) to inherit attributes and behaviours from an existing class (base class) and add further functionality to it.

It promotes code reuse and the creation of a hierarchy of classes.

34
Q

What is instantiation?

A

The process of creating an instance (object) of a class.

It involves allocating memory and initializing the object based on the structure and behaviour defined by the class.

35
Q

What is polymorphism?

A

The ability for methods of the same name to be used in inherited classes with different behaviours exhibited.

36
Q

What is encapsulation?

A

Data held within a class (attributes) that can only be accessed via its methods.

They cannot be accessed directly, thus promoting data hiding and the principle of information hiding.