Paper 2 Flashcards
Each line of assembly code is equal to …… lines of machine code
One
Assembly language created to
Speed things up
Assembly language made
Opcodes easier to read because used a mnemonic and operand to form an instruction
Assemblers
What do they do
Translate assembly language to machine code
Assembly language
Negative
Time consuming
Hard to read debug and maintain
Grace Hopper
Idea
Her idea
Creating compiler to translate English code to machine code
Took 3 years to be taken seriously
What did people think computers could do
Who changed that
Computers could only do arithmetic
Grace Hopper
High level languages examples
Fortran
COBOL
High level languages
Properties
Easier to read
Easier to Maintain and debug code
High level languages can be translated using
Compiler or interpreter
Compiler
What will it do
Create a single executable file that can be run without original source code
(Translates high level languages)
Interpreter
What will it do
Translate high level languages
Run the source code one line at a time and doesn’t create executable file
Compiler Can do (document)
Create fully translated version of a document and use whenever need to
Takes time
Not need original document anymore
Easily share translated document
Interpreter
Can do
(Document)
Translate each line of document individually whilst you use it
Quick to do initially
Always need interpreter when wanting to use document
To share, others would need interpreter
High level language definition
Written in formal structured English
Easier for humans to read, maintain and debug
Low level language definition
Written in machine code or assembly language, quickly executed by a computer
Interpreter definition
Translates and executes a program one line at a time
Always required for code to execute
Compiler definition
Translates program into executable file that will work independently from the source code
Translator
Executes the programs that programmers write in high level language
Machine code definition
Represented by 0 and 1s
Only language a computer can execute
Example of
Machine code
Assembly language
High level language
0011001100100
mov edx, DWORD PTR [rbp-0x4]
Int c=a+b
If a program written in assembly language uses 400 lines of code, how many lines of machine code would there be
400 lines of code
What is needed in order to translate assembly language to machine code
Assemblers
Machine code is specific to ….
CPU
Who first conceived the idea of a compiler
Grace Hopper
Advantages of subroutines
Easier to spot errors and fix because dealing with smaller problems
Easier to reuse code
Used with other apps
Allows to decompose the problem in structured format
Large programming problem can be divided between programmers
Purpose of trace tables
Run through an algorithm and simulate what a computer would do if the program were to execute
Test the logic of an algorithm - errors can be spotted
To categories of subroutines
Procedures
Functions
Procedure definition
Executes a specific set of commands when it is called
Never returns a value
Function definition
Used to calculate or process a value based on arguments given
Always returns a value
Return value definition
A value that is returned by a function
Parameter definition
Used in a subroutine to allow values to be passed into them
Argument definition
The values held in the brackets of a subroutine call
Passed into a subroutine via the parameters
Subroutine definition
A sequence of instructions to perform a specific task with an identifiable name
Def meaning in programming
Defines the subroutine
Variable definition
Holds a value in a memory location that is needed for the execution of your program
Can hold one value at a time
Initialising definition
Initial value is assigned to the variable
Declaration definition
Declare a variable as a certain data type
Assignment meaning
Change the value held at the variable location
IDE stand for
Integrated development environments
IDE
Created for
Give programmers all the tools they needed to write programs in one place
IDE
Allow programmer to
Write run and debug code without switching programs
IDE
Includes
Colour coding Highlight important syntax structures Automatically indent code Autocomplete lines Point out any errors
IDE will call…
Interpreter to translate the code and allow program to be run and tested