Section 1 Flashcards
Standard algorithms
- Input validation
- Running total in loop
- Traversing a 1D array
Predefined Functions
- Round:
Rounds numbers to certain no. of sig figs
eg SET size TO ROUND (measurement, 2) - Length:
Returns the number of characters present in a value held in a variable
eg SET numberOfCharacters TO LENGTH (firstname) - Random:
Returns random value in given parameters
eg SET bonusBall TO RANDOM(1, 59)
Storing real numbers
Stored using mantissa and exponent
mantissa x base ^ exponent
Types of errors
- Syntax [eg misspelling]
- Logic [eg code out of order]
- Execution/run time [eg dividing by 0]
Factors affecting readability
- Whitespace
- Meaningful variable names
- Internal commentary
Logical operators
- AND
- OR
- NOT
Storing vector graphics
Stored as a series of objects with a list of attributes
objects: square, ellipse
attributes: x- and y- coordinates, fill colour, length
Storing bitmapped graphics
Stored as a grid of pixels, each with it’s own unique binary code
Types of loops
conditional: keeps repeating until a condition is met.
eg while loops
unconditional/fixed: repeats a set number of times.
eg for loops
Number of bits for an ASCII string
Each character is 1 byte (8 bits)
Compiler
- translates source code into ‘object code’
- compiler is only held in RAM for the time that it takes to translate source code into object code
- translates lines one after the other but does not execute a line immediately after translation
- once created, object code can run independently of development environment and translator software
- if the object code file contains errors, the program will crash or cause unexpected output. Programmers must revisit source code, identify and correct errors and recompile
- used on finished, working programs
Interpreter
- each line of source code is directly translated to machine code one at a time
- each line of code is executed as soon as it is translated
- interpreter software is present in main memory during each execution of program and execution of every line
- execution will stop immediately if the interpreter translates a line of source code that results in an error, and user will be notified
- used on unfinished programs
Concatenation
The operation of joining character strings end-to-end
Iteration
Returning to previous stages of the development process
Methods to save energy
- settings on monitors
- power down settings (eg standby)
- leaving computers on standby
Buses
Address bus:
- uni-directional, from the processor to RAM
- holds the address in RAM that the processor is accessing
Data bus:
- Bi-directional, between the processor and the memory
Central Processing Unit
Handles the instructions used to ensure that hardware and software respond as expected. Tasks:
- fetch, decode and execute instructions from RAM
- perform arithmetic calculations
- perform logical operations
- control read, write, clock, interrupt and reset lines
Arithmetic Logic Unit (ALU)
All calculations and logical decisions are handled by the ALU, eg storing real numbers. Tasks:
- performs all calculations
- performs comparisons on numeric values
- makes decisions based on logic (AND, OR, NOT)
Registers
temporary storage locations within the processor. stores addresses, data or instructions
RAM (Random Access Memory)
The processor can write to, or read from, RAM at high speed. RAM holds all the programs currently in use. Data can only be stored temporarily, all data in RAM is lost when the power is switched off
ROM (Read Only Memory)
Data in ROM cannot be changed, this is fixed when the chip is manufactured. Data is stored permanently in ROM – it is not lost when the power is switched off
ASCII
Stands for American Standard Code for Information Interchange
Each character (letter, number, symbol or control character) is represented by a binary value
Each character requires 1 byte (8 bits) of storage
Malware
Short for malicious software. Types include:
* Viruses
* Trojans
* Worms
* Hacking
* Spyware
* Keylogger
Firewalls
A program that helps stop hackers, viruses and worms from entering a computer over the internet. filters incoming and outgoing traffic. Only trusted users will be permitted access.
Encryption
Data is scrambled so that it can only be understood by those with a key. Prevents hackers from being able to understand your data.
Memory Addresses
The processor has to be able to pinpoint any storage location
needed so each storage location has its
own unique address
Storing real numbers
mantissa x base^e
Explain why it may be necessary to return to the design stage
- logic errors were found at a later
stage - new functionality is requested
- the program is not fit for purpose
Why are predefined functions used
- no need to write code
- error free (no need to test)
- re-useable