1.2.4: Types of Programming Language Flashcards

(42 cards)

1
Q

What is Machine Code?

A
  • Closest to what actually happens in a computer
  • Programs directly in 1’s and 0’s
  • Least abstract
  • Translate directly into matching electrical signals: 1 for high voltage, 0 for low voltage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Assembly Language?

A
  • Next level up from Machine Code
  • Uses mnemonics so easier to use than Machine Code
  • Each mnemonic matches a specific sequence of binary
  • One-to-one relationship
  • Written in Assembly Language and translated by a specific assembler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are High-Level Languages?

A
  • First languages that could go further than Machine Code and Assembly Language (First developed in the early 50’s, starting with Fortran)
  • One-to-many relationship, as each instruction could give rise to many lines of Machine Code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are Programming Paradigms?

A
  • Different approaches to using programming language to solve a problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you decide what Paradigm to use?

A
  • Depends on the type of problem that needs solving
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Imperative Programming?

A
  • The use of code that clearly specifies the actions performed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Procedural Programming?

A
  • One of the most widely-used paradigms
  • Uses a sequence of instructions which may be contained within procedures
  • Instructions are carried out in a step-by-step manner
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Procedural Programming used for?

A
  • A wide range of software development as it is easy to implement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a drawback of Procedural Programming?

A
  • It is not possible to solve all kinds of problems with Procedural Languages, or it may be inefficient to do so
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the advantages of Procedural Programming?

A
  • Can be applied to a wide range of problems (that can easily be expressed as a series of instructions)
  • Is relatively easy to write and interpret
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What do Procedural Languages use?

A
  • Traditional data types such as integer and strings which are built into the language and also provide data structures like dictionaries and arrays
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Object-Oriented Programming?

A
  • Applicable to certain types of problem with lots of reusable components with similar characteristics
  • Built on entities (Objects) formed from Classes with certain Attributes and Methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the main focus of Object-Oriented Programming?

A
  • Making programs that are reusable and easy to update and maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the focus of Declarative Programming?

A
  • Stating the desired result rather than the exact series of instructions that need to be performed to get the result
  • It is the role of the programming language to determine how to best obtain the result
  • The details about how the result is obtained are abstracted from the user
  • Common programming in expert systems and AI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is Functional Programming?

A
  • The concept of reusing a set of functions that form the core of the program
  • Programs are made up of lines of code consisting of function calls, often combined within each other
  • Closely linked to Maths
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are Logic Languages?

A
  • The use of code which defined a set of facts and rules based on the problem
  • Queries are used to find answers to problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is Structured Programming?

A
  • A popular subsection of Procedural Programming in which the control flow is given by four main programming structures
18
Q

What are the four main programming structures in Structured Programming?

A
  • Sequence
  • Selection
  • Iteration
  • Recursion
19
Q

What is Sequence?

A
  • Code is executed line-by-line, top to bottom
20
Q

What is Selection?

A
  • A certain block of code is run if a specific condition is met [IF statements]
21
Q

What is Iteration?

A
  • A block of code is executed a certain amount of times or while a condition is met [FOR, WHILE, or REPEAT UNTIL loops]
22
Q

What is Recursion?

A
  • Functions are expressed in terms of themselves and are executed calling themselves until a certain condition (base case that does not call the function) is met
23
Q

What is ADD in LMC?

A
  • Instruction: ADD
  • Add the contents of the memory address to the Accumulator
24
Q

What is SUB in LMC?

A
  • Instruction: SUBTRACT
  • Subtract the contents of the memory address from the Accumulator
25
What is STA in LMC?
- Instruction: STORE - Stores the value in the Accumulator into the memory address given
26
What is LDA in LMC?
- Instruction: LOAD - Load the Accumulator with the contents of the memory address given
27
What is BRA in LMC?
- Instruction: BRANCH ALWAYS - Branch - Use the next address given as the address of the next instruction
28
What is BRZ in LMC?
- Instruction: BRANCH IF ZERO - If the Accumulator is zero, branch to the address given
29
What is BRP in LMC?
- Instruction: BRANCH IF POSITIVE - If the Accumulator is positive or zero, branch to the address given
30
What is INP in LMC?
- Instruction: INPUT - Input into the Accumulator
31
What is OUT in LMC?
- Instruction: OUTPUT - Output the contents of the Accumulator
32
What is HLT in LMC?
- Instruction: HALT - Stops the execution of the program
33
What is DAT in LMC?
- Instruction: DATA - Used to indicate a location that contains data
34
What are Machine Code instruction made up of?
- Operand and Opcode
35
What is the Operand?
- Holds a value which is related to the data on which the instruction is to be performed
36
What is the Opcode?
- Specifies the instructions to be performed
37
What does the Addressing Mode do?
- Specifies how the Operand should be interpreted
38
What is Immediate Addressing?
- The Operand is the actual value upon which the instruction is to be performed, represented in binary
39
What is Direct Addressing?
- The Operand gives the address which holds the value upon which the instruction is to be performed (Used in LMC)
40
What is Indirect Addressing?
- The Operand gives the address of a register which holds another address, where the data is located
41
What is Indexed Addressing?
- 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 - This is necessary to add an offset in order to access the data stored contiguously in memory such as in arrays
42