Programming languages Flashcards
What are programming languages?
A structured way of writing instructions
What is machine code?
A binary representation of instructions in a format that the CPU can decode and execute
What are low level languages? (5 points)
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
What are high level languages? (4 points)
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
What is an interpreter? (2 points)
Translates source code from high level languages into machine code
The program is translated line by line
What is a compiler?
Translates source code from high level languages into object code and then machine code
The whole program is translated before it is run
Give three pros and cons of an interpreter
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
Give three pros and cons of a compiler
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