Page 32 - ipp11
P. 32

5.  Which of the following is a characteristic of Python?                                    (1)
                  (a)  It is a low-level programming language.
                  (b)  Python does not support object-oriented programming.
                  (c)  Python is an interpreted and dynamically typed language.
                  (d)  Python code must be compiled before execution.
             Ans.   (c)  Python is an interpreted and dynamically typed language.
              6.  Which of the following is a valid identifier in Python?                                  (1)
                  (a)  3rd_value                            (b)  my@name

                  (c)  pass                                 (d)  Myname
             Ans.   (d)  Myname
              7.  Which of the following is an immutable data type in Python?                              (1)
                  (a)  Lists                                (b)  Dictionary
                  (c)  Tuple                                (d)  Set
             Ans.   (c)  Tuple
              8.  Which of the following is the correct way to define a tuple in Python?                   (1)
                  (a)  Score = [11, 21, 31]                 (b)  Score = {11, 21, 31}
                  (c)  Score = <11, 21, 31>                 (d)  Score = (11, 21, 31)
             Ans.   (d)  Score = (11, 21, 31)
              9.  What will be the result of the following Python expression?                              (1)
                 final = (5 + 3) * (10 - 4) + (7 * 2) - (8 / 4)
                  (a)  60.0                                 (b)  56.0
                  (c)  158.0                                (d)  48.0

             Ans.   (a)  60.0
              10.  How many times will the following loop execute?                                         (1)

                 for x in range(5, 2, -1):
                    print(x)
                  (a)  4                                    (b)  3
                  (c)  2                                    (d)  5
             Ans.   (b)  3
              11.  What is the purpose of elif statement in Python?                                        (1)
                  (a)  It is used to handle multiple conditions in an if-else block.
                  (b)  It is used to loop over a sequence.
                  (c)  It is used to define a function.
                  (d)  It is used to raise an exception.
             Ans.   (a)  It is used to handle multiple conditions in an if-else block.

              12.  Which of the following code snippets will correctly create a list with 5 elements, all initialized to 0?  (1)
                  (a)  mlist = [0, 0, 0, 0, 0]
                  (b)  mlist = [0] *5
                  (c)  mlist = [0 for _ in range(5)]
                  (d)  All  of  these
             Ans.   (d)  All of these
              13.  What will be the output of the following Python code?                                   (1)

                 1st = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
                    print(lst[1][2])
                  (a)  2                                    (b)  4
                  (c)  6                                    (d)  5
             Ans.   (c)  6



                                                           M.2
   27   28   29   30   31   32   33   34   35   36   37