Topical Information

The purpose of this quiz is to give you a chance to practice the topics involved with nD arrays in C++.

Quiz Information

Questions

  1.  
    TRUE   FALSE   A array that consists of C-strings is actually 3-dimensional.
    TRUE   FALSE   A array structure used to represent the consistency inside a block of cheese will be 2D.
    TRUE   FALSE   Heat flow around the surface of a box would be most compactly stored as a 3D array.
  2. Describe the best way to store heat flow information for the surface of a hollow box.

    
        This could be done in a couple of ways.  The first is to just make a 3D
        array structure of the dimensions of the box and only fill in and
        calculate the heat data on the outside elements.  This wastes all the
        memory for the elements in the middle, though.  Depending on the size of
        the box, this could be huge!
    
        Another way to do it is to take the sides of the box apart.  There would
        be two of each shape:  top & bottom, left & right, front & back.
        The hard part would be calculating the heat flow at the edges as they would
        have to map from one separate piece to another.  But to save memory, it
        could be done.  Would this save memory?  Well, we'd still want to store
        these as a single 3D array, so it would waste space at the corners.  We
        could draw this out and calculate how much memory is wasted in the corner
        regions vs how much memory was wasted with the interior of the box and set
        up/solve the inequality.
    
        Then the only question is, is overcoming the edge heat flow difficulty
        worth it to save any memory the sides storage technique can?  This has to
        be answered by the individual/team implementing the solution.
    
    

  3. Given an array declared as 'double arr[4][13]', answer each of the following:

    1. at any time, the structure contains 4*13 slots for data (how many? this may be a formula...)
    2.  
      TRUE   FALSE   arr[2][4] represents the 5th element in the 3rd row
    3.  
      TRUE   FALSE   arr[2] represents the entire 3rd row
    4.  
      TRUE   FALSE   arr represents the entire array structure
    5.  
      TRUE   FALSE   arr[][4] represents the entire 5th column
    6. the data type of arr[2][4] is double
    7. the data type of arr[2] is double[13]
    8. the data type of arr is double[4][13]

  4. For each dimension an nD array structure has, we need (at least) one loop(s) to process its data. During the entry of data elements, this is often a indefinite-style loop (since we don't know yet how many items there are). Once data is entered and we are processing the elements, the loop used is typically a definite/finite-style loop.