P2 T2 L3 Programming Language Classification Flashcards

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

What is machine code? (2 points)

A
  1. Lowest level – works at the level of the machine, consists of binary numbers for both opcodes and operands

Opcode: operation code / instruction

Operand: either data or memory address where data is held

  1. In machine code, a typical instruction holds an operation code (opcode) in the first few bits and an operand in the rest of the bits
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an instruction set? (1 point)

A
  1. The instruction set is all the instructions that the computer can understand and execute
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is assembly language? (2 points)

In assembly language, what were the two major improvements? (2 improvements) (compared to writing in machine code)

A

The next stage in the development of programming languages was assembly language

  1. A way of writing programs using mnemonics
  2. one-to-one relationship between assembly language and machine code instructions

This featured two major improvements:

  1. Each opcode was replaced by a mnemonic (short written code) which gave a clue as to what the operation did
  2. The operand was replaced by a decimal (or hexadecimal) number
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What advantages did assembly code bring to programmers? (1 point)

A
  1. easier for humans to write, understand and debug programs in assembly language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What disadvantages did assembly code bring to programmers? (1 point)

A
  1. assembly code has to be translated into machine code by an assembler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an imperative high-level language? (2 points)

A
  1. An imperative high-level language consists of a series of commands for the computer to perform – the programmer uses the language to describe how a problem is solved
  2. This is in contrast to a declarative language which focuses on what the program should do without listing the steps needed to achieve the result eg SQL or ProLog
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why do people program in high-level? (1 point)

A
  1. Programmer can think and code in terms of algorithms

This is an example of abstraction

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

How are high-level language statements translated into machine code? (2 points)

A
  1. HLL program has to be converted into machine code before it can be executed
  2. Each HLL command represents several AL / commands
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Advantages of high-level vs low-level languages (3 advantages)

A
  1. Much easier and faster to write, debug and maintain programs
  2. Different high-level languages have been written specifically for different types of problem
  3. High-level language programs are portable – a program written for one type of computer can be recompiled for a different type of computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Disadvantages of high-level vs low-level languages (3 disadvantages)

A
  1. The object code (compiled or interpreted code) may run slower than assembly code or machine code
  2. The object code may occupy more space in RAM – which can be a problem in embedded systems with a small amount of memory
  3. Most high-level languages do not have statements to allow the programmer to manipulate individual bits – essential in some applications, e.g. device drivers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Are machine-code and assembly language high-level languages or low-level languages?

A

low-level languages

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