Sample Questions for Exam 1


  1. Indicate whether each of the following statements is true or false:

    (1) _____ Geodesy is the science (and art) of communicating geodetic information using abstract visual representations (i.e., maps).
    (2) _____ A legend is an example of a geographic feature.
    (3) _____ Azimuthal projections are all conformal.
    (4) _____ Cylindrical projections use cylindrical coordinates.
    (5) _____ Some map projections are both conformal and equal area.

    1. Give a concise definition of an "abstract data type".

    2. List two different implementations used when designing/developing data structures.

    3. Show that is .

    4. Visually illustrate the addition of two vectors in

    5. Given and , evaluate (i.e., the inner product of and ).

    6. Given , evaluate (i.e., the norm of and ).

    7. Suppose you have a line through the points and . Write the equation of this line in slope-intercept form.

  2. Show that the point in polar coordinates (where denotes the angular measure and denotes the linear measure) can be written in Cartesian coordinates as .

  3. Complete the times method in the following CartesianPoint class:
    public class CartesianPoint
    {
        private double[]               value;
    
        private static final int       DIMENSION = 2;
        
    
    
        /**
         * Explicit Value Constructor
         *
         * @param x   The value of the horizontal coordinates
         * @param y   The value of the vertical coordinates
         */
        public Point(double x, double y)
        {
           value = new double[DIMENSION];
           value[0] = x;
           value[1] = y;
        }
    
    
    
    
    
        /**
         * Multiply this CartesianPoint by a scalar
         *
         * @param alpha  The scalar
         * @return       The result of the multiplication 
         */
        public CartesianPoint times(double alpha)
        {
    
    
    
    
    
    
    
        }
    
    }
        

  4. Assume that you have a Drafter class with the following two methods:
        /**
         * Draw a straight (solid black) line segment from the pen's current Point
         * (i.e., the result of the last moveTo() or drawTo())
         * to the given Point.  This method leaves the pen at p
         *
         * @param p    The end of the line segment
         */
        public void drawTo(CartesianPoint p)
        {
         ...
        }
    
    
        /**
         * Lift the pen off of the paper and move it to
         * the given Point
         *
         * @param p    The Point to move to
         */
        public void moveTo(CartesianPoint  p)
        {
           ...
        }
        

    what would be drawn by the following sequence of method calls?

        moveTo(new CartesianPoint(10.0, 10.0));
        drawTo(new CartesianPoint(10.0, 50.0));
        drawTo(new CartesianPoint(50.0, 50.0));
        moveTo(new CartesianPoint(20.0, 20.0));
        drawTo(new CartesianPoint(30.0, 20.0));
        

  5. Complete the two adjustFor() methods in the following RectangularHull class:
    /**
     * The smallest rectangle containing a set of Point objects (represented
     * as two Point objects, one containing the minimal coordinates and
     * one containing the maximal coordinates).
     */
    public class RectangularHull
    {
        private Point max, min;
    
    
        /**
         * Explicit Value Constructor
         */
        public RectangularHull(Point min, Point max)
        {
           double[]          v;
           int               n;
           
           n = min.getDimension();
           v = new double[n];
    
           for (int i=0; i<n; i++) v[i] = min.getCoordinate(i);
           this.min = new Point(v);
    
           for (int i=0; i<n; i++) v[i] = max.getCoordinate(i);
           this.max = new Point(v);
        }
        
    
        /**
         * Adjust this RectangularHull (if necessary) 
         * so that it includes the given Point
         *
         * @param p   The new Point
         */
        public void adjustFor(Point p)
        {
    
    
    
    
    
    
    
    
    
        }
        
    
        
    
        /**
         * Adjust this RectangularHull (if necessary) 
         * so that it includes another RectangularHull
         *
         * @param other   The other RectangularHull
         */
        public void adjustFor(RectangularHull other)
        {
    
    
    
    
    
    
    
    
    
    
        }
        
    
    
    
        /**
         * Get the maximal Point (e.g., the upper right corner)
         *
         * @return   The maximal point
         */
        public Point getMax()
        {
           return max;
        }
    
    
        /**
         * Get the minimal Point (e.g., the lower left corner)
         *
         * @return   The minimal point
         */
        public Point getMin()
        {
           return min;
        }
    
    
    
        /**
         * Create a String representation of this RectangularHull
         *
         * @return  The String
         */
        public String toString()
        {
           return (min.toString()+"\t"+max.toString());       
        }
        
        
    }
        

  6. Write an interface named MapProjection that contains all of the appropriate methods, properly documented.

  7. Using an object that implements the MapProjection interface, complete the following method (that is in a class that extends the Drafter class from above). You may use of the classes above.
        /**
         * Draws a piecewise linear curve defined by an
         * Enumeration of EarthPoint objects.  This method
         * first projects all of the points, then scales
         * and translates them to fit on the screen (which has
         * a lower-left corner of 0,0 and an upper-right corner
         * of screenMax.
         *
         * @param points    The collection of EarthPoint objects
         * @param proj      The MapProjection to use
         * @param screenMax The upper-right corner of the screen
         */
        public void draw(Enumeration     points, 
                         MapProjection   proj,
                         Point           screenMax)
        {
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        {
        

Copyright 2007