Question 6. Validation and verification check are carried out on employee data being entered into a computer system.
(a) Using an example of acceptable data describe a suitable validation check for each of the items of data below. In each case give an example of invalid data that would be detected by the check.
A different validation check must be used in each case. [4]
Employee salary.
A suitable validation check for an employee salary would be a type check, which would ensure the correct data type, in this case real data, is being used for the data stored. For example "£20,000" would be accepted, but "twenty thousand pounds" would be rejected as it is the text data type, not real data.
Question 9. (a) Below is an algorithm to produce the multiplication table for a given number.
Algorithm Multiplication Table.Multiplier is integer {input by user}Product is integer {used to store current answer}i is integer {loop control variable}startmainprog input Multiplier for i = 1 to 12 set Product = i* Multiplier output Product end forend mainprog
(i) Draw circle on the above algorithm to clearly indicate an example of annotation.[1]
set Product = i* Multiplier
output Product
end for
(b) Below is a segment of an algorithm that determines if an item is present in a sorted array.
input SearchValueset Found = False {initialise variables}set i = 0set SizeArray = 9
repeat
set i = i + 1 if SearchVariable = SearchArray[i] then Found = True
until (Found = True) OR (i = SizeArray) OR (SearchValue < SearchArray[i])
Complete the table below to show how each variable changes when the algorithm is performed on the test data given.
Search Value = 41
i SearchArray[i] Found
1 14 False
2 19 False
3 23 False
4 28 False
5 31 False
6 39 False
7 43 False
47
Question 12. (a) State what the output will be for a customer who has bought:
(iii) twenty five bottles of olive oil of total value 45 [1]
Give free bottle of Greek olive oil.
Question 13. Below is an algorithm intended to calculate the area of a circle
Algorithm CalculateArea
Pi = 3.142
Radius is real
Startmainprog
output "Type in the radius"
input Radius
Area = Pi * Radius * Radius
Output "The area is" Area
endmainprog
(b) The line "Area is integer" may cause a problem. Describe the problem that this line may cause and amend the algorithm to remove the problem.
The problem that this line may cause is that an area may not be an integer or whole number, it might be a decimal number, therefore a piece of real data.
You may cross out any words of lines in the algorithm and write your own words or lines. There is no need to completely rewrite the algorithm.
No comments:
Post a Comment