Page 359 - Artificial Intellegence_v2.0_Class_9
P. 359

Ans.  The "<" operator checks if the value of left operand is less than the value of right operand, if yes then condition
                  becomes true.
               30.  Write syntax for "greater than or equal to" operator.
              Ans.  a>= b.

               31.  Is "<" a Assignment operator?
              Ans.  No,"<" is not assignment operator. As, it is a relational operator.
               32.  Optimize these statements as a Python programmer.
                  1 word 'word'
                  2 print word. len()
              Ans.  1 word = 'word'
                  2 print len(word)
               33.  How many types of operations are supported by the Python language?

              Ans.  Python language supports the following types of operations.
                  a.  Arithmetic operations                          b  Comparison (i.e., Rotational) operations
                  c.  Assignment operations                          d.  Logical operations
                  e.  Bitwise operations                             f.  Membership operations
                  g.  Identity operations

               34.  Why do you use 'break' statement?
              Ans.  The 'break' statement can be used to terminate the loop.
               35.  Write the syntax of an 'if' statement in Python programming language.

              Ans.  The syntax of an 'if' statement in Python programming language is :
                  if (condition):
                      Statements
               36.  Write the syntax of an if.....else statement in Python programming language.

              Ans.  The syntax of an if.....else statement in Python programming language is :
                  if (condition):
                      Statements for True
                  else:
                      Statements for False
               37.  Define while loops.
              Ans.  A while loop statement in Python programming language repeatedly executes a target statement as long as a given
                  condition is true.
               38.  Write the syntax of a while loop.

              Ans.  The syntax of a while loop in Python programming language is :
                  while <condition>
                      Statements
               39.  What happened when the condition of while loop becomes false?
              Ans.  When the condition becomes false, program control passes to the line immediately following the loop.

               40.  How can a programmer take user input in Python?
              Ans.  A programmer can take user input in Python using the input() function.


                                                                                    Viva Voce Questions    357
   354   355   356   357   358   359   360   361   362   363   364