Translators Flashcards

1
Q

What are high level languages?

A
  • structured english
  • languages like python and C++
  • source code easy for humans to read
  • computers need to translate it to machine code to read it and run it.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are low level languages?

A
  • tricky for humans to read and write
  • easier for a computer to run
  • consist of machine code and assembly language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are advantages of high level languages?

A
  • the same code will work for many different machines and processors.
  • programmer can easily store data in lots of different structures (e.g. lists and arrays) without knowing about memory structure.
  • code is easy to read, understand and modify.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are disadvantages of high level languages?

A
  • must be translated into machine code before a computer is able to understand it.
  • you don’t have much control over what the CPU actually does so programs will be less memory efficient and slower.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How many instructions of high level code represents machine code?

A

One instruction of high level code represents many instructions of machine code.

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

How many instructions of assembly code represents machine code?

A

One instruction of assembly code represents one instruction of machine code.

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
  • commands in machine code can be executed directly without the need for a translator.
  • you control exactly what the CPU does and how it uses memory so programs will be more memory efficient and faster.
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
  • usually written for one type of machine or processor and won’t work on any others
  • programmer needs to know about the internal structure of the CPU and how it manages the memory.
  • Code is very difficult to read, understand and modify.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the three types of translator?

A

assemblers, compilers and interpreters

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

What are assemblers used for?

A

To turn assembly code into machine code. There are many different assembly languages (to support different CPU types) and each one needs its own unique assembler.

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

What are compilers and interpreters used for?

A

To turn high level languages into machine code.

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

How does a compiler work?

A
  • translates all of the source code at the same time and creates one executable file.
  • only needed once to create the executable file.
  • returns a list of errors for the entire program once compiling is complete.
  • once compiled the program runs quickly but compiling can take a long time.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does a interpreter work?

A
  • translates and runs the program one instruction at a time, but doesn’t create an executable file.
  • needed every time you want to run the program
  • the interpreter will return the first error it finds and them stop - this is used for debugging.
  • programs will run more slowly because the code is being translated as the program is running.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What translator is used?

A

Depends on the programming language and IDE you’re using.

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

What is used if the program is stored over multiple source code files?

A

A linker is used to join all the separate compiled codes into one executable program.

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