Page 74 - Information_Practice_Fliipbook_Class11
P. 74

6.  What will be the output produced on the execution of the following instructions by the Python interpreter?
              >>> #Play with the argument: end
              >>> m1, m2, m3 = 10, 20, 30
              >>> print(m1 + m2, m3 - m1, m2 * m3, end = '***')
              >>> print(m1 + m2, m3 - m1, m2 * m3, end = '***')
         Ans.  30 20 600***
              30 20 600***
          7. What will be the output produced on the execution of the following Python script?
              #Play with sep
              m1, m2, m3 = 10, 20, 30
              print(m1 + m2, m3 - m1, m2 * m3, sep = '***')
              print(m1 + m2, m3 - m1, m2 * m3, sep = '***')
         Ans.  30***20***600
              30***20***600
           8.  Write a statement in Python to assign the value 16 to the variable age and to assign the value 'Kolkata' to the variable
              city.

         Ans.  age = 16
              city = 'Kolkata'
           9.  What will be the output produced on the execution of the following code segment in Python?
              num1 = num2 = 50
              Num2 = 100
              print(num1, num2)
         Ans.  50    50
          10.  What will be the output produced on the execution of the following code segment in Python?
              num1 = num2 = 50
              num2 = 100
              print(num1, num2)
         Ans.  50    100

           11  Write the escape sequences for the following:
              (i)  Horizontal tab         (ii) Newline
         Ans.  (i)  \t                    (ii) \n
          12.  What will be the output produced on the execution of each of the following instructions in the Python shell:
              (i)  >>> print('We all like \n to play')
              (ii)  >>> print('Tomorrow is a \t holiday')
              (iii) >>> Print('Tomorrow is a \t holiday')
         Ans.  (i)  We all like
                  to play
              (ii)  Tomorrow is a holiday
              (iii) NameError: name 'Print' is not defined.
          13.  Give output produced on the execution of each of the following:
              (i)  print('Sun','Mon','Tue', end='@@@')
              (ii)  print('Jan','Feb','Mar',sep='-', end='#Quarter#')
         Ans.  (i)  Sun Mon Tue@@@
              (ii)  Jan-Feb-Mar#Quarter#




          60   Touchpad Informatics Practices-XI
   69   70   71   72   73   74   75   76   77   78   79