0% found this document useful (0 votes)
9 views5 pages

Comp Science 2

The document outlines Homework 4 for Unit 6 on flowcharts and algorithms, including tasks for drawing a flowchart for password validation and completing an algorithm for calculating student marks. It requires students to fill in missing steps in a flowchart and identify basic programming constructs, iteration examples, and decision symbols used in the algorithm. The assignment is structured to assess understanding of flowchart creation and algorithm design.

Uploaded by

14osisadan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Comp Science 2

The document outlines Homework 4 for Unit 6 on flowcharts and algorithms, including tasks for drawing a flowchart for password validation and completing an algorithm for calculating student marks. It requires students to fill in missing steps in a flowchart and identify basic programming constructs, iteration examples, and decision symbols used in the algorithm. The assignment is structured to assess understanding of flowchart creation and algorithm design.

Uploaded by

14osisadan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Homework 4 Flowcharts

Unit 6 Algorithms

Name:Daniel.................................................................. Class:................... Mark:................

1. Draw a flowchart for a program which asks the user to enter a password. If the user enters
“HiThere!” then print “Welcome”, and then end the program.
If they enter a different password, print “Wrong password” and end the program. [4]

Start

input password

if password N if password

“Hi there” is different

Print “welcome”

Print “wrong

Password”

end

2. An algorithm is to be written which calculates the average of a set of student marks


entered. If -1 is entered, then the program ends. The flowchart on the next page describes
the steps in the algorithm. However, most of the stages have been omitted.
1
Homework 4 Flowcharts
Unit 6 Algorithms

(a) Complete the flowchart, using the item number from the list of
items given below. [6]

Item number Item description


1 Is mark = -1?
2 INPUT "Enter next mark"
3 OUTPUT "No marks entered"
4 INPUT mark
5 count = count + 1
6 OUTPUT average
7 total = 0
8 Is count = 0?
9 total = total + mark
10 average = total / count

2
Homework 4 Flowcharts
Unit 6 Algorithms

(b) State the three types of basic programming constructs that have been used in the
algorithm. [3]

Count =

Coiunt +1

Is mark -1 is count output avaverage

Total = 0 count = count + 1

Count = Count +1 ouput “no marks

entered

Output “no marks

Entered

Input “enter

Mark again

3
Homework 4 Flowcharts
Unit 6 Algorithms

4
Homework 4 Flowcharts
Unit 6 Algorithms

(c) How many examples of iteration are there in the algorithm? [1]

(d) How many decision symbols are used in the algorithm? [1]
2

[Total 15 marks]

You might also like