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]
Parameter passing: used to pass data from one subprogram to another; can either be passed by value (data will not change) or by reference (changes to the data will be made)
Variable scope: where a variable can be used in a program; local (only inside the subprogram in which the variable has been created) or global (can be used in any subprogram)
Subprograms: named blocks of code which can be run from within another part of the program; often used to break a large program into smaller steps
Functions: a type of subprogram used to return a single value eg round, random
Procedures: a type of subprogram that will follow a set of given instructions
Methods: a function in an object-oriented language that is defined inside a class
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to publish this here.
· Low-level: language that a computer will understand; consists of 0s, 1s; examples include assembly code and machine code
· High-level: language that a human will understand; use of English words such as repeat, if, loop, put
· Procedural: code will processed logically and in a set order; passes data from one procedure to another using parameters
· Declarative: consists of a knowledge base of facts and rules that can be queried
· Object-Oriented: objects are created using classes that will contain code and data (encapsulation); data associated is known as attributes and its values are known as states; sub-classes can inherit attributes from a pre-defined class
· Interpreter: takes each line of source code, translates it into machine code then passes it to processor to carry out that instruction; it works its way through the program one line at a time
Advantages
Disadvantages
A program will run even if it is not finished
No copy of machine code is saved meaning the source code has to be translated every time taking longer
Easy to spot errors during the translation
The process of translating the program slows down the running of it
Program will run as soon as the first line is translated
You will need to have a translator program or you cannot run it
· Compiler: reads the source code and translates the entire program into machine code once; machine code then saved and kept and doesn’t need to be further translated before run
Advantages
Disadvantages
The machine code is saved so the program only needs to be translated once
You have to wait until the code is complete and the errors have been fixed before the translation can be finished and the machine code is run
The user does not need a translator program to run the machine code therefore the program runs quicker
Each time the program is changed it needs to be re-translated
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to publish this here.
Quite a few students have been asking for a better explanation of how the Internet works. This sequence of videos takes you through all areas and aspects of the Internet. If you have a Khanacademy account (you do S4) then you can even earn a badge for watching the videos.
It is well worth a watch for National 4,5 & higher and it will now be making up part of our future courses.
So I was reading a programming blog from a few years ago that was asking, why can’t programmers.. program?. The article set a challenge to
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
Now technically the answer to the puzzle uses nothing more than Nat 5 constructs, so can you code a Python solution? Share it here if you get a nice one
Still a lot of confusion over the definition of a function and procedure in Higher Computing Science and how they differ.
A procedure is a sub program that contains a block of code. It uses parameters to pass data to and from the main program.
A function is a sub program that contains a block of code. It uses parameters to get data from the main program and passes back a single piece of data using RETURN.
In the program below you can see a procedure called calcArea and a function called funcArea. Both of these sub programs do the same thing but they way the work is different. The last two lines of code could be merged into
MsgBox(“Function Area =” & funcArea(10,11)).
The procedure is always called on it’s own. Can you name another function shown in the program below?