Page 420 - Ai_417_V3.0_C9_Flipbook
P. 420

if (num == 100):
                        print ("Number is:", num)
                    print ("Thanks!")
                  7.  5=a

                     b=int(input(Enter value for b))
                     if a<b
                         print('a is bigger")
                     Else:
                       print("b is bigger"
                Ans.  Correct code is:

                    a=5
                    b=int(input("Enter value for b: "))
                    if a>b:
                        print("a is bigger")
                    else:
                        print("b is bigger")
              E.  Solve the given expressions based on operator precedence:

                  1.  2 ** 5 – 35 // 3                              2.   not 15 < 2 or 2 ** 3 > 12/3
                Ans. 32 – 11                                      Ans.  not False or 8 > 12 / 3
                    21                                                not False or True
                                                                      True or True
                                                                      True
                  3.  6 * 5 – 14 // 7 + 2 ** 3                     4.  50 // 9 - 2 * 5
                Ans.  30 – 2 + 8                                  Ans.  5 - 2 * 5

                    36                                                5 - 10
                                                                      -5
                 5.  3 ** 3 + 10 – 22 // 2
                Ans. 27 + 10 – 11
                      37 – 11
                      26


                                                SECTION B (Subjective Type Questions)

              A.  Short answer type questions:

                  1.  What is a program?
                Ans.  The  step-by-step  instruction  written  in  any  programming  language  to  do  a  specific  task  is  known  as  a  Program.
                    A program is written in any programming language which the computer can understand and execute.
                  2.  What is CodeCombat?

                Ans.  CodeCombat is a free coding educational game that teaches you to learn JavaScript or Python coding in a fun way. It
                    is available for all age groups to suit the needs of all levels of coding and computer science learners.

                  3.  What is the use of an arrow in flowchart?

                Ans.  It represents the direction of flow of instructions in a flowchart.



                    418     Touchpad Artificial Intelligence (Ver. 3.0)-IX
   415   416   417   418   419   420   421   422   423   424   425