Pseudocode Algorithm Development Worksheet: Exercises and Examples - Prof. Akerman, Exercises of Computer Science

This worksheet develops algorithms using pseudocode, covering data types, boolean expressions, and algorithm writing for diverse problems. Exercises include sequence, selection, and iteration constructs, such as counting numbers, inputting scores, calculating averages, and simulating a rock, paper, scissors game. It enhances algorithmic thinking and pseudocode implementation, providing practical skill-building exercises. Suitable for introductory programming students, it builds a foundation in pseudocode and algorithmic problem-solving, preparing them for advanced tasks. The exercises gradually increase in complexity, fostering confidence in pseudocode writing and offering a comprehensive resource for instruction and self-study.

Typology: Exercises

2024/2025

Uploaded on 05/22/2025

bananana-apple
bananana-apple 🇬🇧

4

(1)

25 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Worksheet 5
Developing algorithms using pseudocode
Unit 6 Algorithms
Name:...................................................................................................... Class: ......................
Task 1
The below table shows a number of values. For each one, choose the correct data type used to
store it. The first row has been completed for you.
Value Data type Value Data type
3 Integer 'A' Character
TRUE 3.02
-6 '4'
"Hello" FALSE
-3.0 "P"
Task 2
The below table shows a number of Boolean expressions. For each one, state whether it
evaluates to TRUE or FALSE. The first row has been completed for you.
Expression Evaluates to… Expression Evaluates to…
5 > 2 TRUE 80 < 80 FALSE
24 + 1 <= 25 16 – 1 < 16
5^2 == 25 3 >= 3
5 != 3 "Hel" + "lo" == "Hello"
2 == '2' age == age + 1
1
pf3
pf4
pf5

Partial preview of the text

Download Pseudocode Algorithm Development Worksheet: Exercises and Examples - Prof. Akerman and more Exercises Computer Science in PDF only on Docsity!

Developing algorithms using pseudocode

Unit 6 Algorithms

Name: ...................................................................................................... Class: ......................

Task 1

The below table shows a number of values. For each one, choose the correct data type used to store it. The first row has been completed for you. Value Data type Value Data type 3 Integer 'A' Character TRUE 3. -6 '4' "Hello" FALSE -3.0 "P"

Task 2

The below table shows a number of Boolean expressions. For each one, state whether it evaluates to TRUE or FALSE. The first row has been completed for you. Expression Evaluates to… Expression Evaluates to… 5 > 2 TRUE 80 < 80 FALSE 24 + 1 <= 25 16 – 1 < 16 5^2 == 25 3 >= 3 5 != 3 "Hel" + "lo" == "Hello" 2 == '2' age == age + 1

Developing algorithms using pseudocode

Unit 6 Algorithms

Task 3

  1. Examine the pseudocode program given below. The operator MOD, e.g. a MOD b gives the remainder when integer a is divided by integer b. 1 print("This program prints selected numbers in in given range. ") 2 anotherGo = "Yes" 3 while anotherGo == "Yes" 4 lowNumber = input("Please enter first number in your chosen range.") 5 highNumber = input("Please enter the last number in your chosen range.") 6 x = 0 7 for count = lowNumber to highNumber 8 if count MOD 5 != 0 AND count MOD 7 != 0) then 9 print(count) 10 x = x + 1 11 endif 12 next count 13 print(str(x) + " numbers") 14 anotherGo = input("Another go?") 15 endwhile (a) Which lines show an example of the ‘Sequence’ programming construct? (b) Which lines show an example of the ‘Selection’ programming construct? (c) There are two examples of iteration statements in the program. On which lines do each of the ‘Iteration’ programming constructs begin and end?

Developing algorithms using pseudocode

Unit 6 Algorithms

  1. Write a pseudocode algorithm which inputs numeric scores and prints the average score. The end of the data is signalled by a user input of -1.

Developing algorithms using pseudocode

Unit 6 Algorithms