1/48
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What are computer programs (algorithms)?
A group of instructions that the CPU can use to carry out a particular task
In what languages can programs be written in?
High / Low Level
What eventually happens to all computer program languages?
They get translated into machine code
What is machine code?
A group of binary instructions (1s and 0s) that a computer / microprocessor can process
What is the order of language levels?
High level languages -> Assembly language -> Machine code -> Hardware
What does assembly language consist of?
Mnemonics
What is the hardware of a computer program?
Its instruction set
How do you get from a high level language to machine code?
Compiler / Translator
How do you get from assembly language to machine code?
Assembler
Which are the main high level languages?
Kotlin, Java, C, C++, C#, JavaScript, Python, Ruby
Are high level languages portable or not?
Yes, they are
What does it mean for language code to be portable?
It can be used on many different types of computer
Why is high level language good for programmers?
They don't need to know how to manipulate memory locations or registers, and don't need knowledge of hardware or the instruction set, so they can focus on the problem being solved
What is the benefit of a high level language using English-like statements?
Easier and faster to write code, as well as modify, maintain and debug them
In what must you write high level language code?
In an IDE (integrated development environment) such as IDLE and PyCharm
What useful features do IDEs often have?
Syntax highlighting, autofill and debugging
What is the lowest language level?
Machine code - binary
How does Assembly code work in comparison to machine code?
They work at the same level, using mnemonics to represent each machine code instruction
What is the relationship between assembly code and machine code?
It has an almost 1:1 relationship, where one mnemonic translates to one machine code instruction.
Are low level languages machine dependent or independent?
They are machine dependent, as they have direct access to registers in a processor / other memory locations
What are the benefits of low level code (3 things)?
1) Use machine-specific functions as it works directly with the registers and CPU
2) Instructions can be executed faster, so the speed of processing the programme increases (only if coded to take advantage of direct access to the resources such as memory locations and processor)
3) Translated (assembly language) programmes use less memory (machine code uses least of all)
What are the negatives of low level languages (4 things)?
1) Difficult to understand
2) Need to manipulate memory locations
3) Machine dependent
4) Error prone
What is the primary purpose of all programming language translators?
To convert source code into machine code that the CPU can execute (from high to low level)
What is the difference between C based languages and Python languages in terms of preparation for execution?
C based ones are compiled, Python ones are interpreted
How do compilers work?
The whole programme is translated as one unit, with the source code optimised into one executable machine code programme (sometimes be called object code), with a separate error report.
What does a compiler produce?
A new, executable file made from optimised source code, as well as a report of all errors found.
How can compiled codes be run?
Compiled programmes can be used (run) without the compiler
What is the relationship to machine code with a compiler?
A single high level language statement might end up stored as several machine code instructions
How are compilers used in the industry?
Used to distribute a file which can be run without the compiler so users don't have to down load / buy a new compiler
Benefits of compiled programs (3 things)
1) Compiling produces fast, executable code that runs directly on the processor.
2) No need for a translation software on the machine where the code will be executed—the code is platform independent
3) Source code is not accessible and cannot be modified
Disadvantages of compiled programs (3 things)
1) More difficult to debug as one error can produce lots of spin-off errors
2) Comments/source code are not visible once compiled
3) Future changes require code to be recompiled
How does an interpreter work?
A translator that converts and executes source code one line at a time (in machine code), where the previous line is discarded once used.
What happens if an interpreter encounters an error in the code?
It stops execution immediately until the error is fixed, with the error location also being output.
What does an interpreter produce?
Nothing, so the interpreter has to translate the code every time the programme is needed.
How can interpreted codes be run?
Interpreted programmes CANNOT be (executed/run) without the interpreter
What is the relationship to machine code with an interpreter?
A single high level language statement might mean executing several machine code instructions
How are interpreters used in the industry?
Used in programme development as line by line error correction means errors can be corrected immediately, allowing the programmer to carry on developing the code very quickly.
Advantages of using interpreters?
It makes debugging easier and faster because errors are identified immediately as they occur.
Disadvantages of using interpreters?
Speed of execution of program loops is slower as each line has to be interpreted individually every time it is run
How do assemblers work?
The whole low level language pro gramme is translated from the mnemonics into one executable machine code programme.
What does an assembler produce?
A new, executable file is made
How can assembled codes be run?
Assembled programmes CAN be used (run) without the assembler
What is the relationship of assembled code to machine code?
A single low level language statement usually translates to a single machine code instruction
How can assemblers be used in the industry?
Where a programmer needs to directly access specialist hardware, such as in an embedded system or to make a device driver. Must be run as a stand-alone programme without the assembler.
In terms of electronic circuitry, what is machine code?
A binary code of 1s and 0s, processed by the computer CPU. It is dependent on the processor's architecture, using the instruction set of (binary) commands issued by the chip manufacturer.
What is byte code?
An intermediate version of a program produced by some high-level languages to achieve platform independence (partly compiled, but must be interpreted / compiled again at run time)
What is platform independence?
The ability of a program to run on any machine regardless of the underlying operating system or hardware.
What role do Virtual Machines play in platform independence?
They translate byte code into the specific machine code required by the host hardware.
What is object code?
The machine-specific code produced after translating source code (often used in the context of assembly).