Page 71 - Touchcode_C7_Flipbook
P. 71

Exercise


                 A.  Tick ( ) the correct option.

                     1.  Which of the following is the starting index of an array?
                         a.  0                                        b.  –1

                         c.  1                                        d.  2
                     2.  Which one is an incorrect array?

                         a.  Arr[ ]=[‘a’ , ‘b’ ,’c’ ,’d’]             b.  Arr[ ]=[1 , 2 ,3 ,4]
                         c.  Arr[ ]=[1, ‘a’, ‘b’, 2]                  d.  Arr[ ]=[2.0 , 9.4, 5.6 , 6.7]

                     3.  Which of the following term defines array?
                         a.  A group of elements of same data type

                         b.  A type of collection having more than one element

                         c.  Elements are stored in memory continuous locations

                         d.  All of the above
                     4.  Which of the following statement describes the collection?

                         a.  Collections group multiple elements into a common set

                         b.  It increases the performance of the program
                         c.  Consume less memory

                         d.  All of the above

                     5.  What does collection consist of?
                         a.  Lists                                    b.  Sets

                         c.  Maps                                     d.  All of the above


                 B.  State whether the following statements are true (T) or false (F).

                     1.  Collection can hold both homogeneous and heterogeneous elements.

                     2.  Collection does not hold object types.


                     3.  Array improve readability of code by using a single variable for a large set of data.


                     4.  Modifying a collection's elements while iterating will not throws an error.

                     5.  Collections that are not immutable are mutable.







                                                                            Understanding Arrays & Collections   69
   66   67   68   69   70   71   72   73   74   75   76