Page 1 - Home Assignment - LISTS
P. 1

Home Assignment


                                          Computer Science

                                                     Class – XI


                                                   Topic: LISTS




                   1.  Differentiate list and string.

                   2.  What will be the output of the following command:
                       a)  print([2,4,6,8,10][-5])

                       b)  print([2,4,6,8,10][-5])

                       c)  print([2,4,6,8,10][2:])
                       d)  print(['abc', 'pqr', 10][1][2])

                       e)  print(['A', 'B', 'C'] <= ['0', '1', '2'])
                       f)  print([10, 20])*2 + ['a', 'b']

                   3.  Explain the following list functions and give one example of each.
                       a)  append

                       b)  extend

                       c)  insert
                       d)  reverse

                       e)  index
                       f)  sort

                       g)  clear
                       h)  count

                       i)  pop

                       j)  remove
                   4.  Write a program to read N number of integers of a list and find it’s mean

                   5.  Write a program to read N number of names of a list and print it in descending order
                       each in a new line
                   6.  WAP that takes list L as an argument, adds 5 in all odd values, 10 in all even values
                       and prints the list.

                   7.  Write a program to add 5 in all odd values, 10 in all even values of a number list and
                       print the updated the list.

                   8.  Write a program to find the count and sum of all numbers ending with 3 in an
                       integer list.
                   9.  Write a program to find occurrence of an element in a number list
   1   2