Page 172 - Computer Science Class 11 With Functions
P. 172

7.  A pair of __________________ is used to override the precedence of operators.
           8.  Explicit conversion is also called ______________.
           9.  The process of identifying and removing logical errors is known as __________.
          10.  A ________________ error will be generated, on interpreting int(num), if num is a string that cannot be converted to
              an int, for example, '$100'.
        D.  Answer the following questions:
           1.  Identify the data type for the following data objects:
              a.  "Kamani"
              b.  [1,4,"yes",90.6]
              c.  2-8j
              d.  True
              e.  None
         Ans.  a.  str
              b.  list
              c.  complex
              d.  bool
              e.  None
           2.  Identify the real and imaginary part of the complex number, 4-8j.
         Ans.  real : 4.0
              imag : -8.0

           3.  What is the difference between mutable and immutable objects?
         Ans.  An object that can be modified after it is created is called mutable, for example, objects of type list, and set.

                An object that cannot be modified after it is created is called immutable, for example, objects of type int, float, tuple,
              str.

           4.  Add a pair of parentheses to each of the following expressions so that it evaluates to True.
               (i) 2 == 1 == 0
              (ii) 5<4 == 4<3
         Ans.   (i)  (2 == 1)  == 0

              (ii)  (5<4) == (4<3)
           5.  Which function is used to get the data type of an object?
         Ans.  type()
           6.  Name three sequence types.
         Ans.  string, list, tuple
           7.  Using non-negative indexes, what is the index of the first element of a sequence?
         Ans.  0

          8. Consider the following string:
              text = "Read the newspaper"
              What will be the output of the statements given below:
                (i)  text[1]
               (ii)  text[6]
              (iii)  text[15]
         Ans.    (i)  'e'
               (ii)  'h'
              (iii)  'p'


         170   Touchpad Computer Science-XI
   167   168   169   170   171   172   173   174   175   176   177