Programming Flashcards
Why is it necessary to have a variety of programming languages?
- different languages suit different jobs
- developers prefer certain languages
computer program
a series of instructions that are executed one after another.
follow the pattern: INPUT -> PROCESS -> OUTPUT
3 programming constructs
sequence, selection, iteration
Sequence
do one statement after another in the correct order
Selection
do a set of statements based on conditions allow your code to make choices- otherwise known as branching
iteration
do a set of statements again and again (looping)
count controlled loops
repeat a set number of statements a fixed number of times
condition controlled time
repeat a set number of statements until a condition is met
Variable
a name refer to a particular memory location that is used to store data. The value of the data held in that memory location is not known when the program is written and can change while the program is running
constant
name used to refer to a fixed value. The value is set when the code is written and cannot change while the program is running
procedure
a self-contained set of commands that can be called from different parts of the program. returns 0 or many values.
function
a sub-routine that make take one or more parameters and ALWAYS returns a value
uses of functions and procedures
breaking a problem into manageable sections
preventing duplicating sections of code when it is needed more than once in a program
why is manageable code important
easy to read, debug and easy to maintain
\
integer division
AND
if both inputs are true the output is true else the output is false
OR
if both inputs are true or one input is true the the output is true else the output is false
NOT
reverses the outcome of the expression
assignment operator
single equals, sets the value on the right equal to the value on the left
procedural language
programming languages where the user gives step by step instructions of what to do
assembly language
a low level language represented by mnenomics which represents the machine code. one-to-one relationship with machine code.
programming paradigm
a way to classify programming languages based on their features.
3 programming paradigms
`procedural
Object Orientated
Assembly
why can assembly code for one processor not work for another processor
each type of processor has its own unique instruction set