Java: Array Quiz

Name __________________________________

Assume the following:

   int[] a = {25, -3, 6, 0, -3, 6};
   int[] b = new int[100];
   int[] c = null;

  1. _____________ Value of a.length ?
  2. _____________ Value of b.length ?
  3. _____________ Value of b[50] ? Write "illegal" if this is illegal.
  4. _____________ Value of c[50] ? Write "illegal" if this is illegal.
  5. _____________ Value of n after:
        int n = 0;
        for (int i=0; i<a.length; i++) {
            if (a[i] < 0) {
                n++;
            }
        }
  6. _____________ Value of n after
        int n = 0;
        c = a;
        int n = c[1];
  7. _____________ Value of n after
        int n = 0;
        c = a;
        for (int i=0; i<a.length; i++) {
            c[i] = a[i]+1;
        }
        n = a[2];
  8. _____________ Value of n after
        int n = 0;
        for (int i=0; i<a.length-1; i++) {
           for (int j=i+1; j<a.length; j++) {
               if (a[i] == a[j]) {
                   n++;
               }
           }
        }