2.5 Programming Languages Flashcards

GLHF <3 (24 cards)

1
Q

What is machine code?

A

1) Binary representation of instructions in a format that the CPU can decode and execute
2) Have an operation code (opcode) instruction and address or data to use (operand)

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

How are low-level languages written and translated?

A

1) Written in assembly language
2) Translated by an assembler into machine code

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

How are high-level languages written and translated?

A

1) Source code is written in languages such as Python, C++, Java, and Visual basic
2) Translated by a compiler or interpreter into machine code

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

What are low-level languages used for?

A

Used for embedded systems and device drivers where instructing the hardware directly is necessary.

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

Why are high-level languages used?

A

Makes the writing of computer programs easier by using commands that are like English

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

What are disadvantages of low-level langauges?

A

1) One instructions is translated into one machine code instruction
2) This code works on one type of processor only
3) Code is harder to write and understand

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

What are advantages of low-level languages?

A

1) Memory-efficient
2) Code is fast to execute
3) The programmer works with memory directly

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

What are advantages of high-level languages?

A

1) One source code instruction translates to many machine code instructions
2) Code will run on different types of processors
3) The programmer has lots of data structures to use
4) Code is quicker and easier to understand and write

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

What are disadvantages of high-level languages?

A

1) Less memory-efficient
2) Code can be slower to execute if it is not optimised

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

What is the purpose of translators?

A

Code written in both assembly and high-level source code is converted into binary code for execution. This is the purpose of a translator.

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

What does a compiler do?

A

Translates source code from high-level languages into object code and then into machine code ready to be processed by the CPU. The whole program is translated into machine code before it is run.

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

What does a compiler create?

A

A compiler will create a single, executable file that can be run without the original source code

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

What are the advantages of a compiler?

A

1) No need for translation software at run-time
2) Speed of execution is faster
3) Code is usually optimised
4) Original source code is kept secret

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

What are the disadvantages of a compiler?

A

1) Source code is easier to write in a high-level language but the program won’t run with syntax errors, making it more difficult to write the code
2) Code must be recompiled when the code is changed
3) Designed for a specific type of processor

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

What does an interpreter do?

A

Translates source code from high-level languages into machine code ready to be processed by the CPU. The program is translated line by line as the program is running.

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

What are the advantages of using interpreters?

A

1) Easy to write source code because the program will always run, stopping when it finds a syntax error
2) Code does not need to be recompiled when code is changed and it is easy to try out commands when the program has paused after finding an error
3) This makes interpreted languages very easy for beginner programmers to learn to write code

17
Q

What are the disadvantages of using interpreters?

A

1) Translation software is needed at run-time
2) Speed of execution is slower
3) Code is not optimised
4) Source code is needed

18
Q

What are the four functions Integrated Development Environments (IDEs) provide?

A

1) Debugging tools for finding logic errors
2) Help with preventing and identifying syntax errors
3) Providing a run-time environment
4) Usability functions

19
Q

How do IDEs provide debugging tools for finding logic errors?

A

1) Breakpoints - stopping a program at a line of code during execution
2) Stepping through lines of code one at a time to check which lines are executing
3) Tracing through a program to output the values of variables

20
Q

How do IDEs help with preventing and identifying syntax errors?

A

1) Illustrating keyword syntax and auto-completing command entry
2) Error highlighting
3) The compiler produces an output of the error message to help identify it

21
Q

How do IDEs provide a run-time environment?

A

1) Output (run-time) window
2) Simulating different devices the program should use

22
Q

How do IDEs provide usability functions?

A

1) Navigation, showing/hiding sections of code
2) Formatting source code
3) Find and replace
4) Comment or indent regions

23
Q

What is the path of low-level languages to machine code?

A

Low-level language -> assembler -> machine code (binary)

24
Q

What is the path of high-level languages to machine code?

A

High-level language -> compiler (translator) -> object code -> machine code (binary)
OR
High-level language -> interpreter (translator) -> machine code (binary)