Page 62 - Touchcode_C7_Flipbook
P. 62

4                        UNDERSTANDING ARRAYS &


                                                                                   COLLECTIONS








                          Learning Outcomes

                       Introduction                                    What are Collections?
                       What are Arrays?                                How can we Iterate Over Collections?

                       Modifying Collections




                  INTRODUCTION

                  In the previous chapter, you had learned about functions. In this chapter, you are going to
                  learn how to work with a large set of data in programming.

                  WHAT ARE COLLECTIONS?

                  A collection is a container which groups multiple elements into a single object. Collections
                  are used to store, retrieve and manipulate stored data.

                  Example of collection:

                      Collection of cards
                      Telephone directory

                  Advantages of collection:

                      It groups multiple elements into a common set.
                      It increases the performance of the program.

                      It increases productivity, which means based on the requirement the size could be get
                      altered even after its declaration.

                      It consumes less memory.
                      It can hold both homogeneous and heterogeneous elements.


                                                                                                    Experiential Learning
                                                       Coding Task            01



                                                       Is 36 a perfect square?

                   In this task, you will learn to write an algorithm to know if a number is a perfect square
                   or not.



                   60     Touchcode-VII
   57   58   59   60   61   62   63   64   65   66   67