Activity Sheet 12 : Pseudocode



Activity Sheet 12 : PseudocodeThis week we will look at pseudocode. Pseudocode is a method of representing algorithms using a syntax that resembles a real programming language. It enables algorithms to be represented independent of a specific programming language.Each exam board has its own form of pseudocode. Any algorithms given in exam papers will be written in the exam board’s pseudocode. Students need to be able to interpret algorithms given the pseudocode their exam board uses.Task 1: In pairs, look at the algorithm written in OCR pseudocode below:3905250186689What would you expect the algorithm to do?00What would you expect the algorithm to do?int radius = 0real area = 0.0input radiusif radius < 1 or radius > 30 thenprint(“Sorry, that radius is invalid”)elsearea = 3.142 * (radius ^ 2)print(area)end if*From OCR J276 Component 2 Sample PaperTask 2: In pairs, compare the syntax used in the pseudocode shown above to Python syntax.What are the differences?____________________________________________________________________________________________________________________________________Task 3: In pairs, work out the answers to the following questions by examining the algorithm.Name a variable that is used in the algorithm. __________________________________________________________________Give an example of where selection is used in the algorithm.__________________________________________________________________What is the ^ operator used for?_________________________________________________________________Task 4: ExercisesIn pairs, try these challenges:Extend the algorithm so it gives the user the option of calculating another area or ending the program. Use a while loop to repeat the algorithm until the user chooses to end it.__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________Now turn your algorithm into a Python program. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download