0% found this document useful (0 votes)
8 views

Flowcharts&Pseudocodes Fund

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)
8 views

Flowcharts&Pseudocodes Fund

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/ 15

Flowcharts & Pseudocodes Test-Bank

Q1) The output of the following pseudocode is :


1. c = 1
2. if c < 8 then goto step 4
3. goto step 7
4. if c mod 3 > 0 then print c
5. increment c by 1
6. goto step 2
7. stop

a. 1 2 3 4 5 6 7
b. 1 2 4 5 7
c. 1 2 3 4 5 6
d. infinite loop
Q2) What is the output of the following flowchart ?

a. 5 11 7
b. infinite loop
c. 5 11 18 7
d. 5 6 7 7
Q3) The following pseudocode reads 5 numbers and print the summation of
positive numbers only, find the wrong step if exist.

1. start
2. sum = 0, c = 1
3. input x
4. if x > 0 then sum = sum + x
5. c = c + 1
6. if x < 5 goto step 3
7. print sum
8. stop

a. step 4
b. step 6
c. step 7
d. the pseudocode is correct

Q4) The selection structure is also known as :


a. looping structure
b. while-do structure
c. sequence structure
d. if-then-else structure
Q5) What is the output of the following pseudocode, assuming that input x
takes : 3, 5, 9 ?
1. c = 1
2. if c < 4 then goto step 4
3. goto step 8
4. input x
5. print x * x
6. increment c by 1
7. goto step 2
8. print “$”
9. end

a. 3 5 9 $
b. 6 10 18 $
c. 9 25 81 $ $ $
d. 9 25 81 $
Q6) The output of the following pseudocode is :

1. start
2. x = 8, y = 9
3. if (x > 10) then goto 5
4. if (x <= 8) then goto 7
5. y = y - 2
6. goto 8
7. y = y * 2
8. print y
9. y = x
10. end

a. 18
b. 16
c. 8
d. 14
Q7) The following flowchart used to find the maximum number between the
three given numbers a, b, c, fill the blank shapes with suitable steps :

a. shape1 : max = b, shape2 : a > max, shape3 : max = a


b. shape1 : max = b, shape2 : c > max, shape3 : max = c
c. shape1 : b = max, shape2 : c > max, shape3 : max = c
d. shape1 : max = b, shape2 : max > c, shape3 : max = c
Q8) The equivalent pseudocode for the below flowchart is :

a. 1. Start
2. n = 1, m = 5
3. print m + n
4. increment n by 2
5. if n < =m then goto 3
6. print m, n
7. stop

b. 1. Start c. 1. Start
2. n = 1, m = 5 2. n = 1, m = 5
3. print m + n 3. print m + n
4. if n <= m then goto 3 4. increment n by 2
5. increment m by 2 5. if n <= m then goto 3
6. print m, n else increment m by 2
7. stop 6. print m, n
7. stop
Q9) An outline of the logic of the program you will write :
a) Pseudocode
b) Flowcharts
c) None of the above

Q10) Graphically present the detailed sequence of steps needed


to solve a programming problem :
a) Pseudocode
b) Flowcharts
c) None of the above

Q11) In the __________ , one program statement follows another in a


sequential order :
a) Sequence structure
b) Loop structure
c) Repetition structure
Q12) What is the output for the following flowchart ?

a. 3
b. 12
c. 6
d. 5
Q13) The following pseudocode finds and prints the odd numbers between 1
and 15, find the wrong step if exist.

1. start
2. j = 1
3. if j <= 15 then goto 7
4. if j mod 2 <> 0 then print j
5. j = j + 1
6. goto step 3
7. end

a. step 4 should be ( j mod 2 == 0)


b. step 2 should be ( j = 0 )
c. step 6 should be ( goto step 4 )
d. in step 3 , the if condition should be j > 15
Q14) What is the output for the following flowchart given that x = 3, 4, 2, 2, 1, 6?

a. 1
b. 5
c. 2
d. 4
Q15) The following pseudocode finds the summation of the even numbers
between 2 to 100, find the wrong statement in the following pseudocode if
exist :

1. start
2. let sum = 0
3. let x = 2
4. sum = sum + x
5. x = x + 2
6. if x <= 100 then goto step 4
7. print sum
8. end

a. statement 3 , it should be : let x = 1


b. the pseudocode is correct
c. statement 5 , it should be : x = x + 1
d. statement 6 , it should be : if x <= 0 then goto step 3
Q16) Find the output of the following flowchart, given that
x = 4, y = 5

a. 5
b. 4
c. 18
d. 15
Q17) Find the output of the following flowchart, assume that
c = 15

a. 4 6 b. 7 5 c. 6 8 d. None of the above


Answers :

1 b 10 b
2 c 11 a
3 b 12 b
4 d 13 d
5 d 14 d
6 a 15 b
7 b 16 a
8 c 17 c
9 a

You might also like