Page 332 - Computer science 868 Class 12
P. 332

7.  ………………… operator is used to create an array.
                    a.  assignment                                  b.  relational
                    c.  new                                         d.  None of these
                  8.  An array ar[900 ……… 2505] is stored at the base address 1500. Each element of the array occupies 8 bytes in the memory. Find
                    the address of ar[1100].
                    a.  1250                                        b.  3100
                    c.  1275                                        d.  All of these
                  9.  Given an array, arr[1………10][1………15] with base value 100 and the size of each element is 1 byte in memory. Find the address
                    of arr[8][6] with the help of row-major order.
                    a.  210                                         b.  220
                    c.  100                                         d.  1500
                 10.  The correct use of an array is?
                    a.  int ar[56]                                  b.  int ar[]
                    c.  int double[45]                              d.  int a
                 Answers
                   1.  b    2.  d     3.  a     4.   a    5.   c    6.  b     7.  c     8.  b     9.   a   10.  a

              B.  Fill in the blanks:
                  1.  double[] ar={3.5,6.7,7.8,2.3} is a ………………… declaration.
                  2.  An array element is accessed through its …………………  .
                  3.  The function ………………… finds the size of the array ar.
                  4.  The last subscript of an array ar of size 15 is …………………  .
                  5.  int ar[]={4,5,1,2,3};

                    ar[3] = ar[4];
                    for(int i=0;i<4;i++)
                      {
                        System.out.print(ar[i]+",");
                      }
                     The above code will print: …………………

                 Answers
                 1.  static        2.  subscript value    3.  ar.length       4.  ar[14]          5.  4,5,1,3

              C.  Answer the following questions:
                  1.  Name any two types of arrays.
                Ans.  The two types of arrays are Single-dimensional Array and Double-Dimensional Array.
                  2.  How to initialise a double array and a character array with some given values?
                Ans.  The way to initialise a double array and a char array are as follows:
                       a. double array[]={1.2, 3.4, 1.5, 76.4, 55.5};
                     b. char array[]={'a', 'B', '2', '5', ':'};
                  3.  What is searching? Name any two types of searching.
                Ans.  Searching is the way of finding an element in an array.
                     The two different types of search are linear and binary.
                  4.  What is Sorting and searching?
                Ans.  Sorting:
                     a.  Arranging the array elements in ascending or descending order is called sorting.
                     b.  Two types of sorting are: Bubble sort and Selection sort.
                     Searching:
                     a.  Finding an element in an array is called searching.


                330330  Touchpad Computer Science-XII
   327   328   329   330   331   332   333   334   335   336   337