Category: Old Higher

Higher – Revision for Friday 18th of March

Please look over the following SSD areas

Be able to name and describe how the following standard algorithms work.

  • Linear Search
  • Input Validation
  • Find Maximum
  • Count Occurrences
  • Find Minimum
  • Reading from a file

Describe how the following translators work

  • Interpreters
  • Compilers

Differences between high and low level languages

How to use a subprogram

Use of parameters in subprograms

Differences between functions and procedures

 

Higher – Python – Reading from a file

Python-logo-notext.svgA lot of people find reading from a sequential file difficult. Well lets break it down, first of all what is a sequential file? A sequential file is a text based (ASCII or UNICODE) file that is made up of both printing and non printing characters. The end of the file is signalled with EoF, often programmers put data in separate lines using a new line character. Sometimes the files are in CSV format, which means that each line holds a records worth of data.

The basic premise of any Python read file access is

  1. Open file for reading
  2. read each line
  3. close file

This post will mostly be focused on different ways of doing step 2.

Read more

Higher – GCHQ’s Christmas Card and RLE

So I was reading the BBC news website which has an article on GCHQ’s Christmas card.

GCHQ

This led me to wonder what is was as I hadn’t seen one before, it turns out it is a nonogram or picross. Then it suddenly hit me, this is a form of run length encoding, that we will be covering later in the course. It’s just that in this case the encoding is only for black squares. Anyway I just wanted to share it now while it was topical.