CS 495 Test -- The E.R. of Testing

  1. Below is a program in Perl that asks for Doctors ages.  It uses a Max object to find the maximum of the doctor's age.  Write that object.  Show me the program working.  You can slightly modify the code below if you need to.
  2. #!/usr/bin/perl -w
    $a = Max->new();
    print "Enter a doctor's age, or ^D to quit\n";
    while($line = <STDIN>) {
           $a->newValue($line);
    }
    print "The max age is :";
    print $a->getMax();
    print " and that's old!\n";
  3. I have added the tables Edges and polygons to the nations database.  All nations are made of polygons, and the polygon table tells which polygon belongs to which nation.  For example, Iceland is one polygon, and the U.S. is several (one for the mainland, one for Alaska, a couple for Hawaii, etc.)  The edges table tells the points of a given polygon.
    For example, if I wanted to draw Iceland I would look up Iceland in the nations table and find the code "ic".  I would look up the code "ic" in the Polygon table and find that it is described by polygon #88. Write me ONE SQL STATEMENT to do that:
    _____________________________________________________________________

  4. How many points are in the polygons to define the U.S.? _____________________

  5. Write me a PHP program that collects a user name and a password.  If the user name is "ryan" and the password is "deiter" print a page saying "Greetings Dr. Deiter", else print a page saying "Access only for the Dr. Deiter!!"  Show this program to me.

  6. I want to create a table describing Emergency Room accidents.  What SQL create table statement would work.  The types are important here.
  7. Field Name Meaning Example
    Dr Name of the Doctor "Renayee"
    Nurse Attending Nurse "Zach Owens, RN"
    When When it happened Jan 23, 2000, 11:42pm
    What What happened "The doctor slipped and fell.  The scalpel he was holding accidentally stabbed the nurse, who was injecting the patient at the time.  The nurse ripped the artery of the patient as he jerked back.  The patient began to bleed.  Meanwhile, the doctor was finding ice to reduce head swelling.  The patient died."
    Cost Estimate of potential liability $106,274.01
    Picture A picture of the accident scene, jpg format.





  8. Suppose the accident table has 100 items, and the doctor table has 27 items.  Only three doctors have been in accidents.  How many rows will the query "select * from accident, doctor" generate? _____________________
  9. What is DBI?  Is the DBI used to connect to Oracle the same as the DBI used to connect to MySQL?





  10. Write me an SQL query to find the largest nation in area.  0.5 points if you give me a list showing the nation at the top, 1.0 points for generating a table who's ONLY entry is that nation.  Show me on the computer.