SLR 2.5 Translators and facilities of languages Flashcards

1
Q

What is ‘source code’?

A

It is the high level language code written by programmers (for example code in Python, C#, C++ etc.)

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

What is ‘machine code’?

A

It is the binary code representation of instructions that the CPU can decode and execute (once fetched)

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

Why do programmers code in high level languages?

A
  • high level languages are human readable
  • high level languages can be translated to many different architectures / platforms
  • high level languages take fewer lines of code to write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the role of an interpretter?

A

It translates a high level language such as Python, C++ etc. into machine code (binary) one line at a time at run time (when the code is executed)

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

What is the role of a compiler?

A

It translates a high level language such as Python, C++ etc. into machine code (binary) all at once. It produces compiled code which executes very quickly.

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

What is the role of an assembler?

A

It translates assembly code into machine code

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

What is the relationship between instructions in assembler and instructions in machine code

A
  • there is a one-to-one (1:1) relationship between assembler instructions and machine code instructions.
  • both have opcodes and operands
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What type of code is represented below:
1001 0001
0001 0110
0011 0111

A

Machine code

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

What type of code is represented below:
INP
ADD 7
STA 99

A

Assembly code

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

What type of code is represented below:

result = input(“Enter the result”)

A

Source code

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

What is an IDE?

A

an Integrated Development Environment

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

What are the features of an IDE?

A
code completion
code colouring
auto-indentation
debugging
run-time environment
syntax error highlighting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Describe two advantages of using a compiler instead of an interpreter

A
  • The compiled code will run more quickly…
  • …because the instructions only need to be translated once.
  • …because the compiler optimises the code.
  • Source code cannot easily be reverse engineered.
  • …so is more easily protected from being copied.
  • No translation software is required at runtime.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly