Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 154 - 2620_Birla Open Mind C-8
P. 154

    Timeline

                             A list is a collection of data elements in a specific order.

                             Traversing means accessing or visiting the elements of a list.
                             A nested list can be traversed by using the index operator.

                             Negative indexing starts from the index of -1, which is the last element of the list: the index of -2
                           refers to the second last element.
                             Lists are mutable, which means the elements of a list can be changed or new elements can be added
                           to a list by using an assignment operator (=).
                             The various built-in list methods are: append ( ), extend( ), insert(x, a), remove( ), index( ), count( ),
                           pop(i), copy( ), clear( ), sort( ), reverse( ).

                           The various built-in list functions are len(list), max (list), and min(list).
                             Joining,  repeating, slicing, and comparing lists are some of the several operations that can be
                           performed on lists.

                  A.     Choose the correct option.

                          1.  Which of the following indicates an empty list?

                                   a.  { }                                      b.  [ ]

                                   c.  ( )                                      d.  <>

                          2.  Which of the following lists contains another list?

                                   a.  Nested list                              b.  Empty list

                                   c.  Joint list                               d.  Both a. and b.

                          3.  Which of the following does negative indexing mean?

                                   a.  Index of 0 refers to the last elements of the list

                                   b.  Index of -1 refers to the last elements of the list

                                   c.  Index of -2 refers to the last elements of the list

                                   d.  Index of -3 refers to the last elements of the list

                          4.   Which of the following operators is used to access the list elements within a specific range of
                             positive and negative indexing?

                                   a.  #                                        b.  =

                                   c.  *                                        d.  :

                      152  Premium Edition-VIII

| 149 150 151 152 153 154 155 156 157 158 159 |