7. Programming Flashcards
What is an algorithm?
A series of steps to solve a problem.
In what ways can an algorithm be expressed?
- Structured English
- Pseudocode
- Flowchart
What is another name for a flowchart?
Flow diagram
Describe the process by which a program is developed in terms of planning.
- User requirement
- Flowchart
- Pseudocode
- Actual program code
Remember to revise flowchart shapes.
Pg 113 of revision guide.
What is a flowchart?
A diagram using commonly defined symbols to express an algorithm.
What is structured English?
- A way of writing an algorithm in natural language using some basic programming constructs such as IF…THEN…ELSE and loops.
- More structured than just natural language/prose.
What is pseudocode?
A way of writing an algorithm that is close to actual programming language, using coding-style constructs such as IF…THEN…ELSE, loops and array notation as appropriate.
What is sequence?
Where instructions are executed one after another in series.
Is an “End if” needed after a selection statement in algorithms?
Yes, they are usually used just to be really clear.
What is selection?
Where the program will execute certain instructions based on conditions. (e.g. “If” statements)
Give some examples of selection statements.
- IF…THEN…ELSE
* CASE…OF
Why are the different ways of coding a menu system where the user can choose between 3 options?
- Multiple IF statements
- Multiple nested IF statements
- CASE…OF statements
(See Pg 116 of textbook)
What is a CASE…OF statement?
A statement designed for coding multiple choices in a program, such as a menu of several options where the user enters one choice.
(See pg 116 of textbook)
What is iteration?
Where a program will execute certain instructions zero or more times based on a condition.
Remember to revise loops.
Pg 117 of textbook
Can statements like “If EmailAddress does not contain @” be used in pseudocode?
Yes
What is indentation and capitalisation in pseudocode like?
- Should be indented like a normal program
* PascalCase format used for item (all words capitalised but no spaces)
What is Hungarian notation?
- The convention of prefixing identifiers to indicate what type of object they are. Commonly used with forms. e.g. “txt” and “lst”
- Conventionally in lowercase
What is camel case?
The use of capital letters in an identifier to make it more readable. The first word is not capitalised.
e.g. camelCase
What is Pascal case?
The use of capital letters in an identifier to make it more readable. Especially with variables and procedures.
e.g. PascalCase
What is a condition?
A Boolean expression that controls an iteration or selection statement.
What is a Boolean expression?
An expression that is true or false.
e.g. continue=”y”
What is a high level programming language?
A programming language where programming constructs are written in a way that is close to natural language, instead of in mnemonics or machine code.
Give an example of a high level programming language.
- Java
- C++
- Visual Basic
What is machine code?
First generation code - binary instructions where some bits are used to define the operation (opcode) and some bits define the data to be used.
What is assembly language?
Second generation programming language where instructions are in the form of mnemonics.
What is an imperative language?
A programming language such as Python or Delphi which uses a sequence of statements to determine how to reach a certain goal or solve a problem.
What are mnemonics?
Abbreviations representing commands used in assembly language programming.
E.g. LDA, STO, ADX
How many assembly languages are there?
Many - one for each different processor architecture.
Describe the relationship between the language generation system and its link to the hardware.
1st and 2nd generation - Language is processor specific
3rd generation - Independent of hardware (portable)
Describe the language generation system.
1st gen - Machine code - Binary
2nd gen - Assembly language - Mnemonics
3rd gen - High level languages - Statements
(See pg 119 of textbook)
Compare machine code with high level languages.
MACHINE CODE • Processor specific • Designed with hardware in mind • One-to-one relationship with assembly language HIGH LEVEL LANGUAGES • Portable • Designed with type of problem in mind • On height level program instruction translated into several machine code instructions
(See Pg 120 of textbook)
What must be done before a high level language is run?
The program must be translated into machine code.
What type of software are translators?
System software
What are the different types of translator?
- Assemblers
* Compliers and Interpreters
What do different translators do?
- Assemblers - Convert assembly language into machine code
* Compilers and Interpreters - Convert a high level programming language into machine code
Remember to revise the translator diagram.
Pg 120 of textbook
What is an interpreter and how does it work?
A translator that converts high level languages into machine code one line at a time, checking syntax, converting to machine code and executing the code.
What is a compiler and how does it work?
- A translator that converts high level languages into machine code.
- Works through the whole program (source code) checking the syntax, then converting to machine code and creating the executable object code, which can be saved. The object code is executed, not the source code.
What is source code?
The original high level program.
What is object code?
The executable version of the program after it has been compiled.