Texts:
1. (a) Express an algorithm in pseudocode that reads in 3 numbers and prints their mean (average) value. (5 marks)
(b) What are test cases and what is their purpose? Give an example of a test case that could be used for the program in part (a) above? (5 marks)
(c) Draw a flowchart that reads in the age of a user and prints 'over 18' if the age entered is 18 or over and 'under 18' if it is less than 18.
(d) Write pseudocode that uses a loop to sum the numbers from 1 to 20.
(e) What is the value of the binary number 101 in decimal? (5 marks)
(f) Given that the formula for the area, A, of a circle is given by A = πr², write an algorithm in pseudocode that reads in a value for radius r, and calculates the area of a circle with that radius. For this problem take the value of π to be 3.14. (5 marks)
(g) What are the five basic symbols used in flowcharts? For each symbol, give its name and the corresponding function. (5 marks)
(h) Express the algorithm "Print the odd numbers between 1 and 100." using a flowchart with a loop approach. (5 marks)
2. (a) Using a flowchart, illustrate an algorithm for calculating the factorial (e.g. factorial 3 = 3*2*1 = 6) of a number read in from the user. (15 marks)
(b) Draw a flowchart that illustrates an algorithm that calculates the mean value (average) of an array of integers. (15 marks)
3. (a) Using pseudocode, design an algorithm that reads in an array from memory and a number from a user and searches for the number in the array. The algorithm should return whether the number is in the array and the position in the array that the number last occurs. (15 marks)