Programming languages Flashcards

1
Q

What are programming languages?

A

A structured way of writing instructions

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

What is machine code?

A

A binary representation of instructions in a format that the CPU can decode and execute

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

What are low level languages? (5 points)

A

They are written in assembly code
Translated by an assembler into machine code
They are used for embedded systems and device drivers
Code is harder to write
Code is faster to execute

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

What are high level languages? (4 points)

A

They are written as source code
Translated into machine code either by an interpreter or a compiler
Writing code is easier as commands are like English
Code is slower to execute

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

What is an interpreter? (2 points)

A

Translates source code from high level languages into machine code
The program is translated line by line

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

What is a compiler?

A

Translates source code from high level languages into object code and then machine code
The whole program is translated before it is run

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

Give three pros and cons of an interpreter

A

pros - easy to write source code as the program will always run until it finds a syntax error
code does not need to be recompiled when it is changed
makes interpreted languages very easy for beginner programmers to learn

cons - translation software is needed at runtime
speed of execution is slower
code is not optimised

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

Give three pros and cons of a compiler

A

pros - no need for translation software
execution is faster
code is usually optimized

cons - code needs to be recompiled when it is changed
designed for a specific type of processor
the program will not run with syntax errors

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