Category: Old National 5

National 5 – Structures and links web based (Revision)

  • Website – a series of web pages linked together, bbc.co.uk has thousands of linked pages
  • Page – A single page written in html on the internet, normally forms a website when linked with other pages
  • URL – Uniform Resource Locator – The address of the web page
    • http://www1.skysports.com/football/
  • Hyperlinks
    • Internal – links to pages on the same site
    • External – links to a completely different website.
    • relative addressing – a link to a page from the the page you are on, so a link to weather page in the same folder would be
    • <a href=”weather.html” >weather</a>
      • Benefit – less coding, link will still work if the domain name changes
    • absolute addressing – a link to a page that includes where the page is located on a site, so a link to the weather page from any page would be
    • <a href=”http://www.bbc.co.uk/weather.html” >Weather</a>
      • Benefit – easier to follow the code as it shows the whole address.
  • N52
  • Navigation – back, forward, home.
  • Web browsers – software allowing web pages to be viewed. Firefox, Chrome, IE
  • search engines – provide a list of links when a user types a search. Google, Yahoo, Bing
  • Good design to aid navigation – links clearly marked, consistent style
  • usability – Video clips, forums
  • accessibility – large text available, alt tags on pictures

Testing websites

  • Check navigation
  • Checks all hyperlinks/hotspots
  • Ensure graphics are not pixelated and display on site
  • Ensure audio/video clips run
  • Check JavaScript issues
  • Check compatibility with browsers

National 5 – Media Types (Revision)

Standard file formats:

  • Text:
    • txt – only text stored no formatting
    • rtf – Rich Text Format, text and formatting stored, new standard allow for the storing of embedded images.
  • Audio:
    • wav – uncompressed audio
    • mp3 – compressed audio
  • Graphics:
    • jpeg – used for photographs due to strong compression
    • bmp – uncompressed
    • gif – used for animations and drawings, few colours
    • png – compressed with partial transparency.
  • Video:
    • mp4 – compressed
    • avi – uncompressed
  • Pdf: Portable Document Format – used to retain the look and format of a document across difference platforms. Document always looks the same regardless of screen size, fonts etc.

Factors affecting file size and quality

  • Resolution – the number of pixels used to make up the picture.
  • Colour Depth – the number of possible colours used to make up a pixel. The more possible colours the greater the file size.
  • Sampling Rate – in sound files the number of recordings taken per second., the greater the sample rate the higher the quality and file size.

 

Calculation of file size for colour bitmap.

Horizontal Pixels = image width x resolution(DPI)

Vertical Pixels = image height x resolution(DPI)

Number of pixels = Horizontal Pixels x Vertical Pixels

File Size = Number of pixels x colour depth (in bits)

Example 1

N5G

This is enlarged but is 1 inch by 1 inch.

In that case there are 72 x 1 x 72 x 1 = 5184 pixels

Example 2
Bitmap with a resolution of 600×600 pixels in 8 bit colour.
Storage requirements

600 x 600 x 1 bytes = 360000
It is 1 byte as it is 8 bits per pixel
360000/1024 = 351.6 kilobytes

Example 3
Calculate the number of pixels in 4 inch by 5 inch photograph scanned which has a resolution of 600 dots per inch.

Pixels = 4 x 600 x 5 x 600 = 7,200,000 bits
7,200,000 / 8 = 90000 bytes
90000 bytes / 1024 = 878.9 Kb

Vector Graphics
It is possible to edit each object separately, for example, change the shape, colour, size and position.
Even if an object in a vector graphic is quite large, it doesn’t need a lot of computer memory. Therefore the file size of a vector graphic is often very small.
Vector graphics are scalable when you resize them, they do not lose quality.

Need for compression – reduces the file size so that the web page loads more quickly. Reducing bit depth has the same impact. Quality of the image is affected.

National 5 – Structures and links database (Revision)

Database structure:

  • field – the fields below; Exhibitor, Company Name, Area, Stand Number, Product Reference, Item Name, Price (£)
  • record – A single row in a table, there are 8 records below
  • file – the entire database

Flat file database

  • flat file all the data is stored in one table
  • DB1
  • Drawbacks Data duplication Data inconsistency or update/ deletion/insertion anomalies Data integrity errors (due to data inconsistency) Inconsistent search results in multi-value fields
  • Flat file databases can lead to errors as shown below

    DB4

    Is it a man John Silver or a woman Joan Silver for member 1034?

Linked tables

  • Table would be split into
    • EXHIBITOR(Exhibitor Code, Company Name, Area)
    • PRODUCT(Product Ref, Item name, Price (£), Exhibitor Code*)
  • primary keys – these are unique identifiers for each row in a table
  • foreign keys – a primary key from a different table

Database operations

  • Simple search – a search on ABC Music would return the following
    • DB2
  • Complex search – Searching on two (or more) fields at once for example Company name = FutureTech and Price > 1500 would return the following
    • DB2
  • Simple sort – Sorting a table by one field, class registers are sorted by surname
    • Allan, Tom
    • Bennet, Gordon
    • Clark, Petula
    • Donaldson, Luke
    • Elliot, Paula
  • Complex sort – same as above but if two people have the same second name they are sorted by first name as well
    • Allan, Tom
    • Bennet, Gordon
    • Clark, Petula
    • Donaldson, Luke
    • Elliot, Paula
    • Ferguson, Alex
    • Ferguson, Sarah
  • This is in an Ascending order

Field types

  • text – A Roberts, ML1 3XF
  • numbers – 124
  • date – 29 April 2012
  • time – 08:30
  • object – Picture, video or sound file.
  • calculated – pay * 20%
  • link – www.bbc.co.uk
  • Boolean – either yes or no

Validation

  • presence check – data must be entered before the user can continue, primary and foreign keys are normally required.
  • restricted choice – please see below, the user can only select one option.
    • DB3
  • Benefits
    • Reduces the chance of human error
    • Does not require the user to type a text response
    • Speeds up the ordering process as inputs are reduced to mouse clicks
    • Allows the use of a touchscreen
    • Good design to avoid data duplication and modification errors (insert, delete, update)

 

National 5 – User Interface (Revision)

User requirements

visual layout –  eye-catching, simple to use and clear of cluttered buttons and text.

navigation hierarchical, with links organised into sub categories, or linear, where pages are visited in one step-by-step order.

selection – options include clicking on a menu or radio buttons or filling in a form.

consistency – using the same font, colours styles & menus

interactivity – using video/audio, allowing users to post comments etc

readability – use white space and short pages to ensure it is easy to read.

Accessibility – Reading text aloud, alt attributes on image tags or having large fonts for users with eyesight issues.

National 5 – Low-level operations and computer architecture (Revision)

Units of storage:

8 bits = 1 byte
1024 bytes = 1 Kilobyte
1024 Kilobytes = 1 Megabyte
1024 Megabytes = 1 Gigabyte
1024 Gigabytes – 1 Terabyte
1024 Terabytes = 1 Petabyte

Translation of high-level program code to binary (machine code):

  • interpreters – translates source code to machine code line by line, spots errors more easily but takes longer.
  • compilers – translates the source code to machine code in one step, does not spot errors as line being typed, but more efficient. Creates a run time version (object code) that can’t be edited.

Use of binary to represent and store:

  • Real numbers uses mantissa & exponent – 0.256 X 105
    Mantissa = 256 Exponent = 5
  • Characters – ASCII allocates a different binary code to each letter, A = 00100001
  • Instructions, machine code – Binary instructions the processor can understand 10101011101
  • Graphics bit-mapped and vector
    • Bit-mapped graphics are made up of pixels
    • Vector graphics are described in text <rect width=”300″ height=”100″ style=”fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)”>

Basic computer architecture:

  • Processor (CU Ah Luv U Right)
    • Registers – temporary storage locations holding data being processed
    • ALU – deals with comparisons and arithmetic calculations
    • control unit – controls all other parts of the processor, ensures instructions are carried out in the correct order
  • Memory
    • Random Access Memory – temporary data storage only held as long as the computer is switched on.
    • Read only memory – Permanent memory not lost when the computer is switched off, can’t be changed.
  • Buses
    • data – carries data to and from the processor, memory and other devices. Bi-directional
    • address – carries address info from processor to the memory.
    • control – made up of a number of separate wires.
  • Interfaces
    • allows a processor to send and receive data to and from peripherals like printers, scanners, keyboards and projectors.
    • Bluetooth – Wireless
    • USB – Wired

National 5 – Design Notations (Revision)

N4

  • graphical to illustrate selection and iteration
  • other contemporary design notations

N5

  • pseudocode to exemplify programming constructs other contemporary design notations

 

Flow Chart
Flow Chart

You read a flow chart from the START block and follow the arrows (normally downward). In the example above you can see selection taking place in the first diamond, while the second diamond allows for iteration (repetition) to take place.

Structure Diagram
Structure Diagram

A structure diagram shows how the program is structured and in some cases how data can be passed from one part to the other.

Pseudocode

Pseudocode is an informal text description of the working of a program it is written using English words but not in a sentence structure. There are no syntax rules due to its informal nature, sometime they are numbered and sometimes they are not.

The SQA can sometimes refer to pseudocode in the exam when describing a program. However, they are often referring to Standard Reference Language. Rule of thumb, if they are asking you to read pseudocode it will be SRL, if they are asking you to write psuedocode then they mean psuedocode. Hopefully they will start using the correct terms in future papers.

Example 1

  1. set total = 0
  2. set count =0
  3. while count less than 10
  4.     get nextInput from user
  5.     add nextInput to total
  6.     add one to count
  7. end while
  8. display total/10

Example 2

get age from user
while age < 0 or age >130
    display error
    get age from user

display age

National 5 – Algorithm Specification (Revision)

Input validation – checking that what is entered by the user is acceptable.

The following program checks that age is a positive number.

1. SEND “Please enter age” TO DISPLAY
3. RECEIVE age FROM (INTEGER) KEYBOARD
4. WHILE age < 0 DO
5.         SEND “re-enter data” TO DISPLAY
6.         RECEIVE age FROM (INTEGER) KEYBOARD
7. END WHILE

Note that acceptable does not mean accurate, just sensible.

National 5 – Testing and documenting solutions (Revision)

Test Data

For an exam out of 100

  • Normal (data within expected range) – 78, 45,67, 85, 44
  • Extreme (data at limits of expected range)– 0, 100
  • Exceptional (data out with expected range) – -89, bob

Errors

  • Syntax – The rules of the programming language have been broken. E.g. a typing mistake Displya rather than Display
  • Execution – using Average = total / 0 would give an execution error.
  • Logic –will only show up when you run the program. Please see below

counter = 0
while counter < 0:
counter = counter + 1

Readability of code

  • Internal commentary – information about what the program does written by the programmer alongside the actual code. #Green in python.
  • Meaningful identifiers – Calling variable names that mean something length or height rather than L or H
  • Indentation starting parts of the code slightly into the middle of the page making it easier to read.

National 5 – Data types and structures (Revision)

String – text variable like name
Integer – a whole number used for numberOfPeople or items
Real – contains decimals used for distances or measurements
Graphical objects – pictures
Boolean variables – True or False
One Dimensional (1D) arrays – used for a data structure with many pieces of data all of the same data type, such as a list of names. Pupilname[20]