Page 1 :
Sanskar Global School,Pratapgarh, Chapter 9- LOOPING STATEMENTS IN QBASIC, Class-6th, Subject-Computer, Session 2020-21, Note: Copy it to your fair copy., D. Short Answer Type Questions:, Q1. What is the basic use of REM statement/, Ans1. REM statement is used to write a remark or a comment in the program which, does not get executed., Q2. State the use of LET and INPUT statement., Ans2. LET statement is used for assigning the value to a variable., INPUT statement is used for taking a value from the user and storing it in a variable., Q3. Give two examples of looping statement in QBASIC., Ans3. a) FOR….NEXT LOOP, b)DO….LOOP, E. Short Answer Type Questions:, Q1. Differentiate between DOUNTIL…..loop and DO WHILE……loop?, Ans1. DO WHILE...LOOP is used as long as the specified condition is true. If it is false, control, transfers to the first statement after the LOOP which marks the loops end., DO UNTIL is almost similar to DO WHILE LOOP. The only difference is that in the DO, UNTIL....LOOP, the execution of the loop continues as long as the condition is false. It exits, if the condition is true., Q2. When do we use FOR ……NEXT statement?, Ans2. When we want a group of statements to be executed a specific number of times we, make the use of FOR...NEXT statement., Q3. What is a loop? How can it be created in QBASIC?, Ans3. Loop is used to repeat the execution of certain set of statements a number of times., Any looping statement must have the following four components:, a) Initialization: The value from where the loop starts., b) Termination: The value at which the loop ends.
Page 2 :
c) Step up/down: Specifies how the loop moves forward and backward., d) Body of the loop: Statements inside the loop that are to be executed repeatedly., F. Write the output for the following code., 1. FOR X = 7 TO 10 STEP 2, PRINT X, NEXT X, Output: 7, 9, 2. FOR d = 10 TO 1 STEP -1, PRINT d, NEXT d, Output: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, G. Complete the following codes and then try them out., a) X=1, DO WHILE X<11, X= X+ 1, Print X, b) Rem To display square of numbers from 1 to 10., FOR V = 1 to 10, PRINT V * V, NEXT V
Page 3 :
Exercise, A.Multiple choice questions., 1. Name the most appropriate looping statement used when a number of statements has to, be executed a fixed number of times., a) Do While...Loop, b) Do Until....Loop c) For....Next d) None of the above Ans. C, 2. What will be the output for the following program?, CLS, Sum = 0, FOR I = 1 TO 10, Sum = Sum + I, NEXT I, PRINT Sum, a) 22, b) 10, c) 55, d) 11, Ans. C, 3. Counter Variable is also known as _______________., a) Initial value b) Index variable c) Final value d) Step variable, Ans. B, 4. To stop the execution of an endless loop, press _______________ keys., a) Ctrl + Alt b) Ctrl + Break c) Alt + Break d) Ctrl + Delete, Ans. B, 5. _______________ specifies how the loop moves forward and backward., a) Step up/down b) Index value c) Count value d) Termination Value, Ans. A, , B. Fill in the blanks., 1. Loop is used for repeating the execution of a group of statements., 2. Do…. Loop loop is used when we do not know the number of times a loop has to be, executed., 3. Another name of Index variable is Counter., 4. Step Value is the value by which the counter variable is either increased or decreased, every time., 5. LET statement is used to assign the value to a variable., , C. Write True (T) or False (F)., 1. In Do While... Loop, the execution of the loop continues as long as, the statement is false. (False)
Page 4 :
2. A negative number cannot be assigned to the step value. (False), 3. To clear the output screen, we use CLS statement., (True), 4. For taking a value from the user, storing it in a variable and, displaying the result we use the INPUT statement., (True), 5. A loop is used for repeating the execution of statements many times., , (True)