Page 150 - TP_Prime_V2.2_Class8
P. 150

2.  Short answer type questions.
                      a.  What is looping?

                      b.  Write the syntax to the for loop.
                      c.  Write a difference between for and while loop.


                  3.  Long answer type questions.
           Prime (Ver. 2.2)-VIII      4.  Competency-based/Application-based questions.          Century   #Information Literacy
                      a.  Explain range( ) function with an example.

                      b.  Explain Infinite loop with an example.

                      c.  Explain the concept of While loop with the else statement.
                                                                                                   21 st
                                                                                                  Skills

                      a.   A teacher asks Devesh to calculate the sum of all numbers between 1 and 100. Which loop
                         would he use? Explain why one loop is better suited for this task than the
                         other.

          148         b.   Gunjan wants to repeat a block of statements for a given number of times
                         until the control condition is false. For this, what type of loop can she use?

                      Activity Time                                                                   21 st   #Critical Thinking
                                                                                                    Century
                                                                                                      Skills
                  Write the output of the following programs in the respective box.
                      a.  x=1

                         sum=0

                         while(x<=10):
                             sum=sum+x

                             x=x+1
                         print (sum)

                      b.  i = 0
                         while i < 3:

                             print (i)
                             i += 1

                         else:
                          print (0)

                      c.  limit = int(input("Enter a limit for the square values: "))

                         num = 1
                         while num ** 2 <= limit:

                             print(num **2)
                             num += 1
   145   146   147   148   149   150   151   152   153   154   155