Page 97 - Code_GPT_Class_8
P. 97

Q     Answer the following questions:
                    A
                           1.  How do loops help us?




                           2.   Write an if condition to display “We have a match on Sunday” or “No, match on Sunday” based on
                              whether today is Sunday and if there is a cricket match.












                           3.   Write an if condition to display “Exam today” or “No exam on weekend” if it is a weekday today or
                              your exam.














                        Scratch Your Brain.                                             21 st  Century   #Critical Thinking
                                                                                            Skills
                                                                                                #Productivity & Accountability
                        1.  Write the output of the following programs:
                            a.
                               Repeat 5 times                          Num1      4      7      87     45     22
                               {                                       Num2      7      5      34     32     90
                                  READ Num1
                                  READ Num2                             Print

                                  IF Num1 > Num2 THEN
                                      PRINT “Num1 is greater”
                                  ELSE
                                      PRINT “Num2 is greater”
                               }


                            b.    Repeat 5 times                            Marks    45     40     55     49     85

                               {                                            Result
                                  READ Marks
                                  IF Marks > 50 THEN
                                     PRINT "Pass"
                                  ELSE
                                      PRINT "Fail"
                               }







                                                                                          Algorithmic Intelligence  95
   92   93   94   95   96   97   98   99   100   101   102