Page 75 - ModularV1.1 _c7_flipbook
P. 75

Recap


                          Decision making in BASIC-256 is done by conditional statements or decision-making
                        statements that decide the direction of the flow of program execution.

                          The If-Then statement is the simplest conditional statement.
                          The If-Then-Else statement checks for a condition. If the condition evaluates to true, the
                        indented statements following the if statement are executed, otherwise the indented
                        statements following the else statement are executed.
                          The statements used to repeat a set of instructions in a program are called iterative
                        statements or looping statements.



                                                        Exercise



                 A.  Tick ( ) the correct option.

                    1.  Which statement is used to end the WHILE loop?
                      a. END WHILE                         b. WHILE                      c. END-WHILE

                    2.  Which of the following is not a conditional statement in BASIC-256?
                      a. IF-THEN                           b. IF-THEN-ELSE               c. FOR-NEXT
                    3.  Which loop statement do we use when we don't know the loop count?

                      a. While                             b. For                        c. Both a and b
                    4.  What does a loop do?
                      a. Repeats a section                 b. Sets a variable            c. Print Hello

                    5.  In the given statement, what is i?

                       FOR i = 1 TO 100
                      a. Branch                            b. Counter variable           c. Condition

                 B.  Fill in the blanks using the words given below.


                                     WHILE, startNumber, counter, infinite, endNumber, control statement,



                    1.  The conditional statements in BASIC-256 are also called ...................................... .

                    2.  ...................................... statement is used to repeat a set of instructions until a condition evaluates to true.

                    3.   The ...................................... is the starting number of the loop and the ...................................... is the total
                      number of times the loop must run.

                    4.   The ...................................... is a variable that keeps count of the number of times the instructions inside
                      the loop have been executed.

                    5.  A loop that never ends is called ...................................... loop.


                                                                    Conditional and Looping Statements in BASIC-256  73
   70   71   72   73   74   75   76   77   78   79   80