SQA 2007 Q17
Category Archives: Computing Higher
Scanners
OK, I admit it I went on a little about this 🙂
Here is a good post on the working of a scanner and in researching it I found that the video (below) in question was correct for colour CCDs.
[kml_flashembed movie="http://www.youtube.com/v/ZTWQbeE82HU" width="425" height="344" allowfullscreen="true" fvars="fs=1" /]
We will look at CCDs in more detail in next weeks lesson.
Here is a take apart that shows a LED scanner in more detail 🙂
[kml_flashembed movie="http://www.youtube.com/v/AuMkpaenqm8" width="425" height="344" allowfullscreen="true" fvars="fs=1" /]
VB Tab Stops – replacement
I had a quick look at how to set a tab stop in Visual Basic and although it can be done, I think it might be a little beyond the scope of the course, so I looked for a better way of doing it. Here is what I found
ToString.PadRight
Design for Marks
SQA Past Papers
A quick reminder that past paper questions can be found on the blog as well as on the SQA site.
An excercise in fustration
I thought long and hard about today’s task, I set out to make a task that appeared easy to complete but without the correct design would prove to be frustrating.
The task below has been broken down so you need to follow it from start to finish and constantly revisit “finished” parts of the program, this is the iterative nature of programming.
1. Design and create a program that
a. Stores 20 class marks before displaying them and displaying the average to one decimal place.
b. Change the design and program to validate the marks (between 1 & 100) using the supplied function.
c. Change the design and program to also store the names of the students and then display the output in a two column report.
I’ll post the (1c) solution up tomorrow after class, the code for the function is after the break.
Arrays
We use Arrays to store lists of similar items, like class names or class marks. The allows us to reference all the items with the same name and therefore simplify coding by using loops.
Visual basic uses the DIM command to set up an array.
DIM StrName(5) as String ‘ creates a Array with 6 elements of type string Continue reading Arrays
Dice Menu Program
Write a program using the skills you have learned so far to ask the user to select between a 6,12 or 20 sided dice and then to display 5 rolls of that dice. The program should only stop asking when the user enters zero.
Solution after the break
DIM
DIM is used to dimensionalise a variable, that is set memory aside for the variable to be stored. It is used thus
- DIM Number1 as Integer
- DIM Number2 as Integer
However this can be shortened to
- DIM Number1, Number2 as Integer
In this case VB(Express Edition) sets number1 & number2 to integers. A more complex example can be seen below
- DIM StrName as String
- DIM Number1, Number2 as Integer
Becomes
- DIM StrName as String, Number1, Number2 as Integer
You need to be careful that you get your syntax correct. It might be easier at the start to stick with the traditional(top) method.
Computer Structure – Main Memory
OK I may have went a little overboard on EEPROM 🙂 but it is very very useful. Some of you might think that EEPROM and flash memory is the same thing but you would be wrong. Have a look at this from webopedia
Pronounced double-ee-prom or e-e-prom, short for electrically erasableprogrammable read-only memory. EEPROM is a special type of PROM that can be erased by exposing it to an electrical charge. Like other types of PROM, EEPROM retains its contents even when the power is turned off. Also like other types of ROM, EEPROM is not as fast as RAM.
EEPROM is similar to flash memory (sometimes called flash EEPROM). The principal difference is that EEPROM requires data to be written or erased onebyte at a time whereas flash memory allows data to be written or erased inblocks. This makes flash memory faster.