Page 331 - Computer science 868 Class 12
P. 331

Let’s Revisit


                      ♦ An array can be defined as a set of variables that contains values of the same data types having the same variable names but
                     different subscripts required to separate the values. Thus, an array is a composite data type.
                      ♦ There are two types of arrays: Single-Dimensional Array and Double-Dimensional Array.
                      ♦ An array is created in the same way as an object is created, since it uses the new operator.
                      ♦ int array[]={2, 4, 6, 8, 10};  is a static declaration.

                      ♦ int array[]=new int[10]; is a dynamic declaration.
                      ♦ Searching is the way of finding an element in an array. There are two types of searching: linear and binary search.
                      ♦ Binary search : It is a technique to divide the array into two equal halves and searching takes place in either of the two halves,
                     depending on the element to be searched.
                      ♦ There are three types of sorting: bubble sort, selection sort and insertion sort.
                      ♦ Selection sort selects the minimum element from the unsorted part of an array and places it in the next position in the sorted
                     part of the array.
                      ♦ To find the total number of elements in an array, we use the “length” method.
                      ♦ The double-dimensional array stores data in a tabular format, thus containing rows and columns.
                      ♦ InputStreamReader and BufferedReader are used to input values and stored under “io” package.
                      ♦ Since, arrays are contiguous memory locations of the same data type, we can easily find the location of the desired element.





                                                                MIND DRILL



                     Solved Questions


                 A.  Tick ( ) the correct option:
                    1.  How many types of arrays have you studied?
                       a.  1                                           b.  2
                       c.  3                                           d.  None of these
                    2.  Give an example of dynamic declaration of an array.
                       a.  int ar={2, 3, 4, 5, 6};                     b.  String ar[] = {"India", KOlkata", New Delhi");
                       c.  char ch={'a', '2', ':', '4'};               d.  None of these
                    3.  In both types of arrays, the subscript value starts from ………………… .
                       a.  0                                           b.  1
                       c.  any value                                   d.  None of these
                    4.  Searching is the way of finding an element in an array.
                       a.  True                                        b.  False
                       c.  May be true or false                        d.  None of these
                    5.  int ar[]={2,3,4,5,6} contains ………………… number of elements.
                       a.  1                                           b.  3
                       c.  5                                           d.  None of these
                    6.  InputStreamReader and BufferedReader are used to input values and stored under ………………… package.
                       a.  lang                                        b.  io
                       c.  util                                        d.  None of these





                                                                                                                       329
                                                                                                              Arrays   329
   326   327   328   329   330   331   332   333   334   335   336