Page 89 - tp_Modula_v2.0
P. 89

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

                          a.   #                                        b.   :
                          c.   *                                        d.   <>
                     5.   Which of the following method is used to add one element to the list?

                          a.   append( )                                b.   extend( )
                          c.   insert(x, a)                             d.   remove( )

                 B.  Write 'T' for true and 'F' for false.
                     1.   Traversing means accessing the elements of a list.                                ………………
                     2.   The index of elements of a list starts from 1.                                    ………………

                     3.   Nested list can be traversed by using the index operator.                         ………………
                     4.   Lists are immutable.                                                              ………………
                     5.   The extend( ) is used to add more than one elements to a list.                    ………………

                 C.  Fill in the blanks using the words given below:


                                                    mutable, +, item, indexing, sequence


                     1.   List is a …………………… of data elements.
                     2.   In list, each element or value is called an …………………….

                     3.   To access the list elements …………………… is used.
                     4.    …………………… means the elements of a list can be changed or new elements can be added into a list.

                     5.   To join the two list together …………………… operator is used.

                 D.   Short answer type questions.
                     1.   Define the term list.

                     2.   While traversing a list when will user get an IndexError?
                     3.   What is indexing?

                     4.   Name the list method which reverses the order of the elements in the list.
                     5.   What do you mean by the term negative indexing?

                 E.   Long answer type questions.

                     1.   Differentiate between indexing, and slicing.
                     2.   What is the use of replication operator?

                     3.   Describe remove( ), index( ), count( ) list methods.
                     4.   Write a program to add element (12, 2, 34, 65)  to the list=[13, 25, 41, 63, 82].
                     5.   What is the purpose of using max(list) and min(list) functions?







                                                                                                 List in Python   87
   84   85   86   87   88   89   90   91   92   93   94