Digital Learning

Saturday, February 11, 2023

CBSE Computer-Science Class-VII Exercise-10(2022-23):

Computer Science
Class-VII
Chapter-10 QBASIC Looping Statement

A. Fill in the blanks.
1. The ___________ statement starts a loop.
Answer: WHILE

2. In a DO LOOP statement a ________ is repeated while or until a condition is true.
Answer: Block of instructions

3. The FOR statement is placed at the ____of loop and the ______ statement at the end.
Answer: Beginning, NEXT

4. The variable that is appearing in the FOR statement is called the ____ variable.
Answer: Control or Index

5. Each loop within the nest must have its own ________ statement.
Answer: FOR NEXT

B. Write whether true or false:
1. DO LOOP statements can be used in two different ways.
Answer: True

2. In a FOR-NEXT structure, the EXIT FOR statement is used after the FOR statement.
Answer: False

3. The index variable can appear in a statement inside a loop.
Answer: True

4. An outer loop and an inner loop cannot have the same index variable.
Answer: True

5. The FOR statement is placed at the end of loop.
Answer: False

C. Tick the correct option:
1. This statement is used to transfer the program control to the statement after the next statement.
a. For                                 b. EXIT
Answer: EXIT

2. The control variable is incremented by the 
a. step value                    b. control value
Answer: Step value

3. A loop within another loop is known as a 
a. double                         b. nested loop
Answer: Nested loop

4. Looping statement WHILE-WEND closes loop with a 
a. WEND statement    b. WHILE statement
Answer: WEND statement

D. Answer the following questions:
1. Can the index variable in a FOR statement a fractional or negative value?
Answer: Yes, index variable in a for statement may a fractional or negative value.

2. What is the function of a FOR-NEXT loop?
Answer: If we known the exact number of repetitions to be performed, we can use the FOR-NEXT statement conveniently.

3. What is the purpose of a NEXT statement?
Answer: Next statement is used when we want a group of statements to be executed a specific number of times.

4. When the final value of the index variable is smaller than the initial value and the step size is positive, how many times will the loop be executed?
Answer: When the final value of the index variable is smaller than the initial value and the step size is positive, the loop will not be executed.

5. Under that condition will the FOR-NEXT loop be executed only once?
Answer: If the initial and final values of the index variable are equal and the step value is non-zero, then the loop is executed once.

6. Is there any restriction regarding transfer of control in to or out of a FOR-NEXT loop?
Answer: No, The EXIT For statement is used to transfer the program control to the statement after the NEXT statement in a FOR-NEXT structure.

7. State the rules governing nested loop.
Answer: The following rules must be kept in mind while constructing a FOR-NEXT loop:
1. The index variable can appear in a statement inside a loop, but its value cannot be changed.
2. If the initial and final values of the index variable are equal and the step value is non-zero, then the loop is executed once.
3. The loop will not be executed when:
* The initial and final values of the index variables are equal and the step value is zero.

No comments:

Post a Comment