KEMBAR78
22 Flowchart | PDF | Computer Programming | Computing
0% found this document useful (0 votes)
48 views28 pages

22 Flowchart

The document discusses flowcharts and algorithms. It provides examples of flowcharts for tasks like determining if a number is positive or negative, even or odd, finding the greatest or smallest of three numbers, and calculating totals. It also discusses concepts like counting, totalling, and conditional loops. Several problems provide examples of drawing flowcharts to solve tasks like validating parcel weights or rider heights on attractions.

Uploaded by

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

22 Flowchart

The document discusses flowcharts and algorithms. It provides examples of flowcharts for tasks like determining if a number is positive or negative, even or odd, finding the greatest or smallest of three numbers, and calculating totals. It also discusses concepts like counting, totalling, and conditional loops. Several problems provide examples of drawing flowcharts to solve tasks like validating parcel weights or rider heights on attractions.

Uploaded by

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

COMPUTER SCIENCE WITH INQILAB PATEL

Chapter 11

Flowchart
2.1.2 Flowchart

A flowchart is another way of breaking down a program in the form of a diagram.


The following are recognised flowchart symbols:

Write down the name of following flow chart symbols:

Q 11.1) Draw a flowchart that


Inputs a number
Find out number is negative or positive
Output “Positive” or “Negative”

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q 11.2) Draw a flowchart that
Inputs a number
Find out number is even or odd (using MOD function)
Output Even or ODD

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q11.3a) Write an algorithm, using flowchart only, that


inputs three numbers
outputs the greatest number

Q 11.3b) Write an algorithm, using flowchart only, that


inputs three numbers
outputs the smallest number

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q11.4a) Write an algorithm, using flowchart only, that
inputs three numbers
calculate total of two greatest numbers
Output total

Q 11.4b) Write an algorithm, using flowchart only, that


inputs three numbers
calculate total of two smallest numbers
Output total

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

COUNTING
Counting is used to find how many items are there by incrementing by 1 during each time loop is
executed.
It is sometimes necessary to count how many times something happens.
To count up or increment by 1, we can use statements such as:
Count ← Count + 1
(new) (old)
i.e. INCREMENT (old) Count by 1 to get (new) Count

TOTALLING
Totalling is used to calculate running total. We can use a variable such as Total or Sum to hold the
running total and assignment statements such as:
Total ← Total + Number
(new) (old)
i.e. ADD Number to (old) Total to obtain (new) Total
Count-controlled (FOR) loops
Count-controlled loop is used when the number of repetition is already known.

Example Question
a) Draw a flowchart to input 20 numbers and find the total and average of positive numbers

b) Explain how do you change your flowchart to work for 30 numbers that are between 0 and 100.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................................[3]
Redraw the flowchart for part b

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Conditional Loop:
A loop which is executed on the basis of a condition.
Pre-condition (WHILE) loop in which condition is given at the start of loop and which is executed
only when the condition is true, is called pre-condition loop.
Post-condition (REPEAT UNTIL) loop in which condition is given at the end of loop and which is
executed only when the condition is false is called post-condition loop.
Rogue Value A value which stops input, used to terminate loop.
Q 11.8) Draw a flowchart that
Inputs the weight of a number of parcels in kilograms.
Validate parcel (parcels weighing more than 25 kilograms are rejected).
A value of –1 stops the input.
Outputs the total weight of the parcels accepted and number of parcels rejected.
Past Paper Question of same type in Summer 2015 P21& 23 Q 3

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q11.9)Summer 2009
Study the flowchart very carefully.

(a) Complete the table to show what outputs you would expect for the two inputs.[2]
Input N Output T
5
1
(b) Write down a possible LOOP construct for the section A to B in the flowchart using pseudo
code.
…………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………
……………………………………………………………………………... [2]

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q 11.10) Draw an algorithm using flowchart that:


Inputs the height of children who want to ride on a rollercoaster
Validates height children under 1.2 metres are rejected.
When eight children have been accepted, outputs message “Ready to go” and number of
children rejected.

Past Paper Question of same type in Summer 20162210,0478 P21 &P23

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q11.11a) Draw a flowchart that
Inputs 50 number
Find out number is Integer or Real (using INT function)
Count Integer and Odd Numbers
Output how many were integer and odd

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q11.11b) Draw a flowchart that


Inputs a series of numbers
Calculates their total
Stops input if a negative number is entered
Output total.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q 11.12) Draw a flowchart that
Inputs temperature for a week (7 days)
Outputs highest and lowest temperature

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q 11.13) Draw a flowchart that


Inputs marks of a class of 30 students
Outputs how many students are pass and how many are fail

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q 11.14) Draw a flowchart that
Inputs per litre price of 5 different brands of milk
Outputs how average price per litre

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q 11.15) Draw a flowchart that


Inputs a batch of 10 rice sacks for weight
Validates sacks (sacks should weigh 50 kilograms each. Sacks weighing over 50.5 kilograms
or less than 49.5 kilograms are rejected.)
Outputs number of sacks accepted and the number of sacks rejected.
Past paper flowchart for same type of question in Winter 2017 P22 Q5
March 2018 P22 (India)

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q11.16) Draw a flowchart that
Inputs the weight in kilograms of a passenger stepping into a lift.
The lift can take a maximum of eight passengers or a maximum weight of 640 kilograms.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q 11.17) Draw a flowchart that


Inputs name of 10 students in a class and store them in one dimension array
Display list of names of students
Past paper flowchart for same type of question in Winter 2017 P21 Q5

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
116
Q 11.18)Winter 2016 P22 Q 3
Following flowchart is used to convert a denary number into octal (base 8)
The flowchart below inputs an integer. The predefined function DIV gives the value of the division,
for example Z ←11 DIV 3 gives the value Z = 3. The predefined function MOD gives the value of
the remainder, for example Z ←11 MOD 3 gives the value Z = 2.

Complete a trace table for each of the two input values 33 and 75. [4]
Trace table for input value 33
X A B OUTPUT

Trace table for input value 75


X A B OUTPUT

Q 11.19) Draw a flowchart to convert denary number into binary

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Test your flowchart by completing following trace table to convert denary number 20 into binary
[4]

X A B OUTPUT

Q 11.20)Winter 2015 P23 Q 3


(a) This pseudo code inputs an integer. The predefined function DIV gives the value of the division,
e.g. Y 10 DIV 3 gives the value Y = 3. The predefined function MOD gives the value of the remainder,
e.g. Y 10 MOD 3 gives the value Y = 1.gives the value Y = 1.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
118
Complete a trace table for each of the two input values 37
and 191.
Trace table for input value 37
X T1 T2 OUTPUT

Trace table for input value 191


X T1 T2 OUTPUT

(b) State the purpose of the pseudo code in part (a).


............................................................................................................................................................
......................................................................................................................................................[2]

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Draw flowchart for the above pseudo code


Past paper question of same type in Winter 2015 P21 & 22

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q 11.20) Following flowchart is used to count digits in a number
DECLARE Count: Integer
DECLARE Num, x: Real
Count ← 0
INPUT Num
x ← PIN
REPEAT
x ← x/10
Count ← Count + 1
UNTIL x < 1
OUTPUT Count
Draw flowchart for the above pseudo code

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

122
Finding Output from flowchart
Q 11.21)Summer 2006

Trace the flow chart using the numbers 2 and 3. Write down each of the values of N in the order that
they are printed out.
(a) 2 ................................................................................................................................[1]
(b) 3 ....................................................................................................................................[2]

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q11.22)Summer 2007
Study the following flowchart very carefully.

(a) Complete the following table showing the expected output from the flowchart for the three
sets of input data: [3]
INPUT X OUTPUT S
48
9170
- 800

(b) Input data needs to go through a validation process.


(i) Explain the term validation.
………………………………………………………………………………………….
(c) (ii) Describe one type of validation check
……………………………………………………………………………………… [2]

Q 11.23) Winter 2007


Majid lives in Cairo but often travels to Tokyo, Mumbai and Washington. A flow chart has been written
so he can work out the local time in these three places.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL 124

(a) What output would be produced from the following input? [2]
Input Output
place hours (H) minutes (M) H M
Tokyo 11 15 18 15
Mumbai 15 10 18 40
(b) What problem would occur if place = Mumbai and H = 15 and M = 30?
………………………………………………………………………………………… [1]
(c) What problem would occur if place = Washington and H = 4 and M = 0?
………………………………………………………………………………………… [1]
Q 11.24) Summer 2008
The following flowchart inputs two numbers, carries out a calculation and then outputs the result.

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
(a)Complete the following table for the three sets of input data. [3]
INPUT OUTPUT
U V
5 5
6 -6
12 4

(b) The above algorithm has been placed in a library of routines. Give one advantage of doing this.
………………………………………………………………………..................................…………………
.…………………………………………………………………………………………………………[1]

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL

Q 11.25)Winter 2009. P11


Study the flowchart.

Complete the table to show what outputs you would expect for the three inputs. [3]
INPUT N OUTPUT C

55

2100

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/
COMPUTER SCIENCE WITH INQILAB PATEL
Q 11.26) Summer 2010 P12
Study the following flowchart very carefully:

What output would you expect if the following data was input into the flowchart? [3]
X OUTPUT
-150
540
0
`

@inqilab inqilab-patel /inqilabpatel inqilab patel


COMPILED BY: INQILAB PATEL
+923002724734 http://inqilabpatel.com/

You might also like