Page 418 - Computer Science V2.0 Class 11
P. 418

[3, 5, 5, 2, 8, 9, 7, 21, 6, 5, 4]
                     the program should display the list:
                    [27, 5, 5, 8, 8, 9, 343, 21, 6, 125, 4]
                     You should not create a new list, but rather modify the existing list.
                11.  Write a function that takes a list as an input argument (say, key) and search for key in the list. If the key is found
                    in the list the function should return the  index of the first occurrence in the list, otherwise the function should return
                    None.
                12.  Write a function marksUpdate that accepts a list of lists RollNoMarksList (where each inner list comprises a pair
                    of roll number and marks of  students) and the RollNo and returns the updated list with the marks increased by 5
                    corresponding to RollNo. Write a program that accepts pairs of roll number and marks of some students as lists and uses
                    the function RollNoMarksUpdateto increase the marks by 5. Finally, display the updated list.
                13.  Write a function minorModeration() that accepts a list of lists NameMarksList (where each inner list comprises a
                    pair of roll number and marks of students) and returns the updated list with the marks appropriately increased so that the
                    students who just miss the marks by not more than three marks are awarded pass marks.  Generalise your function so that
                    the margin is flexible and not necessarily fixed as three marks. You may like to use a default parameter for this purpose. Write
                    a program that accepts pairs of names and marks of some students as lists and uses the function minorModeration
                    to increase the marks, if necessary.
                14.  Write a function moderation() that accepts a list of lists NameMarksList (where each inner list comprises a pair of
                    roll number and marks of students) and returns the updated list with the marks appropriately moderated according to the
                    following criteria:

                                                Marks range                  Moderation

                                       marks <40                                 6
                                       40<=marks<50                              5
                                       50<=marks<60                              4
                                       60<=marks<70                              3
                                       70<=marks<80                              2
                                       80<=marks<90                              1
                                       90<=marks                                 0
                     Write a program that accepts pairs of names and marks of some students as lists and uses the function moderation()
                    to increase the marks, if necessary.


                      Assertion and Reasoning Based Questions


                     The following questions are assertion(A) and reasoning(R) based. Mark the correct choice as
                    a.  Both A and R are true and R is the correct explanation of A
                    b.  Both A and R are true and R is not the correct explanation of A
                    c.  A is true but R is false
                    d.  A is false but R is true

                 1.  Assertion(A):  Elements of a list can be accessed using indices.
                    Reasoning (R):   The  list  is  a  sequence  data  type,  and  the  elements  of  a  sequence  data  type  can  be  accessed  using
                                indices.
                 2.  Assertion(A):  In the case of linear search, the search key is sequentially compared with the elements of the list.
                    Reasoning (R):  Linear search is only applicable to lists, not to tuples.
                 3.  Assertion(A):  The function call sorted(lst) yields a list sorted in ascending order.
                    Reasoning(R):  The list is a mutable data type.




               404   Touchpad Computer Science (Ver. 2.0)-XI
   413   414   415   416   417   418   419   420   421   422   423