Homework 10: Due November 30th

 

Read chapter 7, sections 7.4 - 7.6, 7.8

  1. Complete checkpoint 7.15
  2. Complete Find The Error: 4-5
  3. Complete Short Answer: 1-5
  4. Complete Algorithm Workbench: 3-5
  5.       int [] sample=new int[8];
          int i, k;
    
          Using the declarations above, show the array after the following statements:
    
          for (k=0; k<8; k++)
             if (k % 2 == 0)
                sample[k] = k;
             else
                sample[k] = k + 100;
    	
  6.       Write the statements to add up those elements of an array of ints (of
          size 25) which have an even subscript.
    	
  7.       Write the statements to add up those elements of an array of ints (of
          size 25) which have an even value.
    	
  8.       What will the following program segment print?
    
          int nums = new int[10];
          int i;
          for (i = 9 ; i >= 0 ; i--) {
             nums[i] = 5 * (i + 1);
             System.out.print(nums[i] + "  ");
          }
          System.out.println();
          for (i = 0 ; i < 10 ; i++)
             System.out.print(nums[i] + "  ");
          System.out.println();
          for (i = 8 ; i >= 0 ; i--)
             nums[i+1] = nums[i];
          for (i = 0 ; i < 10 ; i++)
             System.out.print(nums[i] + "   ");
          System.out.println();
    	

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2013