Page 33 - PYTHON-12
P. 33

18.  Which device is used to connect multiple networks and can translate protocols?            (1)
                (a)  Bridge                               (b)  Switch
                (c)  Router                               (d)  Hub
            19.  Explain the concept of Bandwidth in computer networking.                                  (1)
          Q.20 and 21 are Assertion and Reasoning based questions. Mark the correct choice as:
            (a)  Both A and R are true and R is the correct explanation for A.
            (b)  Both A and R are true but R is not the correct explanation for A.
            (c)  A is true but R is false.
            (d)  A is false but R is true.
            20.  Assertion (A): Default arguments in functions must be placed after non-default arguments.
               Reason (R): This ensures that all parameters can be supplied in the correct order.          (1)
            21.  Assertion (A): GROUP BY clause is used to aggregate data in SQL queries.
               Reason (R): HAVING clause filters records after aggregation function.                       (1)

                                                       Section B
            22.  Differentiate between Lists and Tuples in Python. Provide example.                        (2)
            23.  Describe any two built-in methods of dictionary. Provide syntax and examples.             (2)
            24.  Answer the question using built-in functions. Given the following two lists in Python:    (2)
               fruits = ['apple', 'banana', 'cherry']
               numbers = [1, 2, 3]
                 I.  (a)  Write a statement to insert the string ‘orange’ at the second position of the fruits list.
                                                          OR
                    (b)  Write a statement to extend the numbers list by adding the elements [4, 5] to the list.
                II.  (a)  Write a statement to remove ‘banana’ from the fruits list.
                                                          OR
                    (b)  Write a statement to calculate the sum of all elements in the numbers list.
            25.  Identify the correct output(s) of the following code. Also write the minimum and the maximum possible
               values of the variable start.                                                               (2)
               import random
               Animals = ["ELEPHANT","LION","TIGER","CAT","FOX","HORSE","DOG"]
               last = random.randrange(2)+3
               start = random.randrange(last)+1
               for i in range(start,last):
                   print(Animals[i],end="#")
                (a)  LION#TIGER#CAT#                      (b)  ELEPHANT#
                (c)  FOX#DOG#                             (d)  DOG#
            26.  The following code is intended to calculate the average of the given values. However, there are syntax and
               logical errors in the code. Rewrite it after removing all errors. Underline all the corrections made.   (2)
               def calculate_average(nums):
               total = 0
                  for i in nums
                    total += i
                  average = total / len(nums)
                  return "average"
               values = [10, 20, 30]
               avg = calculate_average(values)
               print("The average is: " + avg)







          A.48                                                           Computer Science with Python–XII
   28   29   30   31   32   33   34   35   36   37   38