Page 344 - Artificial Intellegence_v2.0_Class_9
P. 344

9.  In ………………………. programming, the program instructions are executed one after the other in a sequence.
           10.  The block of statements is executed based on a ………………………. using if statement.

           11.  ………………………. keyword is optional with if statement.
           12.  ………………………. means visiting each element and processing it as required by a program.

           13.  ………………………. indexing begins with -1.
           14.  The elements in a list can be of ………………………. data types.
           15.  ………………………. function will delete all the elements in a list.


        C.  State whether these statements are true or false.
            1.  Modification of the program through flowchart is sometimes time-consuming.               ……….……
            2.  It is easy to represent branching and looping in an algorithm.                           ……….……
            3.  CodeCombat is a free coding educational game available on the internet.                  ……….……
            4.  Integers are used for mathematical calculations.                                         ……….……
            5.  Python is easy to learn as a high-level programming language.                            ……….……
            6.  It is optional to specify colon(:) after writing a condition with the if statement       ……….……
            7.  Step value can be -ve or +ve in for loop.                                                ……….……

            8.  Each value/element is separated by a comma.                                              ……….……
            9.  There are different ways of visiting each element of a list.                             ……….……
           10.  The append() can be used to append any value at any location in a list.                  ……….……

        D.  Find the errors in the given code and rewrite the correct code:
            1.  x,y=10                                       2.  y=int(input("Enter Y:")
               a=input("enter number')                          if y<10
               print("number entered is,a)                          print('smaller")
               a+5,b=10,20                                      else:
               a=a+10                                               print(y)
                   print(a)

            3.  M=int(input("Enter M'))                      4.  str="book"
               while M<10                                       i=0
                if M=5:                                         While i=<1:
                  print("Middle Value")                             print(str, sepa="%")
                else:                                               1+=i
                  print(M)
                M=+1

        E.  Rewrite the following logic:
           1.  Using while loop                              2.  Using for loop
               for C in range(1,5,2):                           sum=0
                   print (C)                                    i=20
               print("Python")                                  while i>10:
                                                                    sum+=i
                                                                        i-=2
                                                                print(sum)

              342     Touchpad Artificial Intelligence (Ver. 2.0)-IX
   339   340   341   342   343   344   345   346   347   348   349