What is the difference between looping and selection? Looping executes the same block of code (module) again and again until a certain condition is fulfilled, while selection execution of a statement(I) depends on a condition that returns true or false ( yes / No
0 Comments
âStudy the flowchart below and answer the questions that follows
âState the name of the control structure shown in the flowchart. (1 mark)
Selection control structure
Assuming the user keys in 8 and 14 when prompted to enter the values for m and N respectively, determine the printed values of P, Q, ï£ and y. (4 marks)
âThe printed values are
P=8, Q=14, x-8 and y=14 âWrite the pseudocode that would be used in place of the flowchart. (5 marks)The pseudo code is as follows BEGIN Print "enter the value of M and Nâ; Read M,N Set c= M; Set y = N; P = y - c; Q = c- y; IF P >Q THEN; Set P = c; Set Q = y; ELSE Set P = y; Set Q = c; ENDIF PRINT P, Q, c, y; END Draw a flowchart which will simulate the processing of Student's report. The simulation should be such that the user repeatedly inputs marks per subject for six subjects using a looping control structure. The computer processes the total marks and mean score of the student.
Note.
State the three basic types of program control structures.
What is meant by the term Dry running as used in program development?
The roots of the equation ax2 + bx + c = 0 are given by the formula Write a pseudocode for the above program BEGIN INPUT A, B, C D= (B*B)-(4*A*C) IF D<0 THEN X1=INVALID X2=INVALID ELSE IF D=0 THEN X1= -B/(2*A) X2=X1 ELSE IF D>0 THEN X1= (- B + SQRT(D))/(2*A) X2= (- B - SQRT(D))/(2*A) END IF END IF END IF PRINT X1, X2 STOP Draw a flow chart for the above pseudocode
State three situations when REPEAT .. UNTIL structure can be used in writing a program
A trader bought a car from a manufacturer and later sold the car to another person. Design a pseudocode that will accept the buying price and the selling price of the car, determine whether the trader made a profit /or loss, calculate the profit/loss and display it.
START
ENTER buying Price, selling price INPUT Bp, Sp IF Bp<Sp THEN Profit= Sp-Bp PRINT Profit Else Loss=Bp-Sp PRINT Loss STOP Design a flowchart for the above case.Highlight three advantages of structured programming.
List three parts that constitute an array definition statement
Array = MyArray {1...n} of
Integer; What is meant by the term ‘dry running’ as used in program development?
State any three activities that occur in a program compilation process (3mks)
Steps in program development cycle in their logical sequence
Name six steps in program development cycle in their logical sequence. (3mks)
|
Categories
All
Archives
January 2025
|
Primary Resources
College Resources
Can't find what you want? Use this Search box. |
Secondary Resources
|
Contact Us
Manyam Franchise
P.O Box 1189 - 40200 Kisii Tel: 0728 450 424 Tel: 0738 619 279 E-mail - sales@manyamfranchise.com |