a)Study the Pseudo code below and answer the questions that follows. BEGIN Print “enter the value of A and B”; Read A, B Y =...

      

a)Study the Pseudo code below and answer the questions that follows.
BEGIN
Print “enter the value of A and B”;
Read A, B
Y = A+B
While Y<20 Do
BEGIN
PRINT Y
A = B
B = Y
Y = B+A
END WHILE
PRINT A, B, Y;
END

i)Assuming the user keys in 2 and 4 when prompted to enter the values for A and B respectively, determine the values of A, B and Y show your working
ii)State the control structures used in the above pseudocode.
b)Draw a flowchart that would be used in place of the pseudocode
c)Give three examples of Iteration construct

  

Answers


Kavungya
a)
i) i) A = 2
B = 4
Y = 2+4 = 6
Y = 6

ii) A = 4
B = 6
Y = 10

iii) A = 6
B = 10
Y = 16

iv) A = 10
B = 16
Y = 26

ii) Control structures
-Sequence
-Loop / iteration / while….do

fig8111020191220.png

c) Examples of iteration construct
-WHILE – DO
-FOR
-Repeat until
Kavungya answered the question on October 11, 2019 at 09:21


Next: The apparatus below were used by a student to study the effect of heat on hydrated copper II sulphate
Previous: Describe three factors that cause system entropy

View More Computer Studies Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions