Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 144 - 2609_Logicode
P. 144

    1.  Tick ( ) the correct option.

                          a.  Which function is used to add multiple elements to a list at once?
                              (i)  append()                                    (ii)  extend()

                             (iii)   addall()                                  (iv)  insert()
                          b.  Lists in python are created in brackets.

                              (i)  { }                                         (ii)  [ ]
                             (iii)  ( ):                                       (iv)  < >

                          c.  Which of the following is used to repeat the string a given number of times?
                              (i)   String Concatenation operator              (ii)  String Replication operator
                             (iii)  len() function                             (iv)  range() function

                          d.  Which of the following escape sequence inserts a new line in a string?

                              (i)  \t                                          (ii)  \n
                             (iii)  \r                                         (iv)  \b
                          e.  Identify the operator used to concatenate two strings in Python.

                              (i)  *                                           (ii)  &
                             (iii)   +                                         (iv)  %

                      2.  Fill in the blanks using the words from the help box.

                                                 string, append( ), nested, Traversing, del

                          a.   We use the _______________ statement to remove an element or a slice of element from a list.

                          b.  Using the _______________ function, we can only add one element at a time.
                          c.  _______________ means visiting each element and processing it as required by the program.

                          d.   A consecutive sequence of characters that is enclosed or surrounded by single or double quotes is
                             known as a _______________.

                          e.  A list can contain other lists as elements, which is known as a  _______________  list.

                      3.  Write 'T' for true and 'F' for false.
                          a.  Slicing lists implies accessing the list elements within a specific range.

                          b.   A single-line string in Python begins and ends with either three single quotes or three
                             double quotes.

                          c.   A list is a type of container that is used to store a list of values of any type.

                      142   Premium Edition-VIII

| 139 140 141 142 143 144 145 146 147 148 149 |