Page 60 - Digicode_AI_class_8
P. 60
3. In a program, the statements following are executed when the condition specified
in the 'if' statement is false.
4. A loop is used to repeat a sequence of instructions multiple times, and there are two types: counting
loops and loops.
C. Answer the following questions:
1. What is a loop?
2. Write the difference between the following with an example of each:
i. AND condition and OR condition
ii. counting loop and a conditional loop
3. Write an if condition to display “Yes” or “No” if it is Sunday today and a cricket match also.
4. Write an if condition to display “Yes” or “No” if it is a weekday today or your exam.
Critical Thinking
A. Write the output of the following programs:
1.
Repeat 5 times
{
Enter Num1
Enter Num2
If Num1 > Num2
Then Num1 4 7 87 45 22
Print “num1 is greater”
Else Num2 7 5 34 32 90
Print “num2 is greater”
Print
}
2.
Repeat 5
{
Read marks
If marks > 50
Then
Print Pass
Else Marks 45 40 55 49 85
Print Fail
} Result
58 DigiCode AI-VIII

