1.2.4 - Types of Programming Language Flashcards

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

What is a programming paradigm?

A

Different approaches to using a programming language to solve a problem.

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

What are the two broad categories of programming paradigms?

A

Imperative and declarative.

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

What are two examples of the imperative programming paradigm?

A

Procedural and object-oriented.

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

What are two examples of the declarative programming paradigm?

A

Functional and logic.

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

What is the main feature of the imperative programming paradigm?

A

A paradigm that uses code that specifies the actions to be performed to solve the problem.

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

What is the procedural programming paradigm?

A

A paradigm that uses a sequence of instructions which may be contained within procedures.

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

What is an example programming language that follows the procedural paradigm?

A

Pascal, python, logo.

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

What is object-oriented programming?

A

OOP is built on entities called objects which are formed from classes that have certain attributes and methods.

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

What is an example programming language that follows the object-oriented paradigm?

A

Python, Delphi, Java, C#.

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

What is the main feature of the declarative programming paradigm?

A

The desired result is stated rather than the instructions that need to be performed. It is the job of the programming language to determine how to obtain the result.

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

What is the definition of the functional paradigm?

A

It uses the concept of reusing a set of functions that form the core of the program.

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

What is an example programming language that follows the functional paradigm?

A

Haskell, C#, Java.

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

What is the definition of the logic paradigm?

A

Uses code which defines a set of facts and rules based on the problem. Queries are used to find solutions.

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

What is an example programming language that follows the logic paradigm?

A

Prolog, SQL.

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

What is assembly language?

A

Assembly language is the next level up from machine code and uses mnemonics rather than binary.

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

What does the assembly instruction ADD mean and do?

A

Add - Adds the value at the given memory address to the value in the accumulator.

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

What does the assembly instruction SUB mean and do?

A

Subtract - Subtracts the value at the given memory address from the value in the accumulator.

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

What does the assembly instruction STA mean and do?

A

Store - Stores the value in the accumulator at a given memory address.

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

What does the assembly instruction LDA mean and do?

A

Load - Loads the value at the given memory address into the accumulator.

20
Q

What does the assembly instruction INP mean and do?

A

Input - Allows the user to input a value that will be held in the accumulator.

21
Q

What does the assembly instruction OUT mean and do?

A

Output - Prints the value currently held in the accumulator.

22
Q

What does the assembly instruction HLT mean and do?

A

Halt - Stops the program at that line, preventing the rest of the code from being executed.

23
Q

What does the assembly instruction DAT mean and do?

A

Data - Creates a flag with a label at which data is stored.

24
Q

What does the assembly instruction BRZ mean and do?

A

Branch if zero - Branches to a given address if the value in the accumulator is zero. This is a conditional branch.

25
Q

What does the assembly instruction BRP mean and do?

A

Branch if positive - Branches to a given address if the value in the accumulator is greater than zero. This is a conditional branch.

26
Q

What does the assembly instruction BRA mean and do?

A

Branch always - Branches to a given address no matter the value in the accumulator. This is an unconditional branch.

27
Q

What does the opcode contain?

A

Data that specifies the instruction to be performed.

28
Q

What does the operand contain?

A

A value that is related to the data on which the instruction is to be performed. This is usually an address.

29
Q

What is the function of an addressing mode?

A

It specifies how the operand should be interpreted.

30
Q

What does the addressing mode ‘immediate addressing’ do?

A

The operand is the actual value upon which the instruction is to be performed.

31
Q

What does the addressing mode ‘direct addressing’ do?

A

The operand gives the address which holds the value upon which the instruction is to be performed.

32
Q

What does the addressing mode ‘indirect addressing’ do?

A

The operand gives the address of a register that holds another address, where the data is located.

33
Q

What does the addressing mode ‘indexed addressing’ do?

A

An index register is used which stores a certain value. The address of the operand is determined by adding the operand to the index register.

34
Q

In object-oriented programming, what is a class?

A

A template for an object that defines the properties and behaviour of an object.

35
Q

What are attributes?

A

The variables that define the properties of an object.

36
Q

What are methods in a class?

A

The functions that define the behaviour of the object.

37
Q

What is a setter?

A

A method that sets the value of a particular attribute.

38
Q

What is a getter?

A

A method that retrieves the value of a given attribute.

39
Q

What is encapsulation?

A

If a variable is defined as being private, it cannot be changed by users so it is encapsulated.

40
Q

What is inheritance?

A

A class can inherit all of the attributes and methods of the superclass but can also have its own attributes.

41
Q

What is polymorphism?

A

Polymorphism is when a subclass alters its inherited methods.

42
Q

What are the two types of polymorphism?

A

Overloading and overriding.

43
Q

What is overloading?

A

When a method in the subclass has the same name as the superclass but different parameters and arguments.

44
Q

What is overriding?

A

When a method is redefined in the subclass with the same name and arguments, this method overrides the superclasses’ method.

45
Q

What are the advantages of using OOP?

A

OOP allows for a high level of reusability.

Encapsulation allows for more reliability and a more robust program.

46
Q

What are the disadvantages of using OOP?

A

It is generally unsuitable for smaller programs as classes cannot be reused.