CS205 Fall 2004 Final Exam

Note, this is not a self-scoring exam, and the submission key gets an error (since the exam is only here for archival purposes.

Instructions: Answer all questions on the form below by selecting the best answer, or filling in the answer where required.

You must press the "Submit Exam" button at the bottom of the form for your exam to be submitted for grading. Please do not leave or refresh this page from your browser window. Instead, start a new browser window if needed. Some people have accidentally lost some answers by leaving this browser window.

This exam has 15 multiple-choice questions plus a programming task. Before starting, scroll to the bottom to make sure you have the whole exam (CNTL-RELOAD if not).

To protect against possible problems (like a computer failure), you might want to WRITE your responses on a separate sheet of paper. You don't need to turn in the sheet of paper - it's just for your protection in case something goes wrong.


Please type your preferred email address (for grades):

During this exam you:

Please write your name to pledge your understanding of these guidelines, and conformance to other UAF guidelines for intellectual integrity (this is required for your exam to be graded):


Multiple choice questions. 15 questions, 1 point each.

  1. CPAN stands for:
    1. Comprehendible Perl Assistance Network
    2. Comprehensive Perl Archive Network
    3. Compendium of Perl Antigen Nanobots
    4. None of the above
    5. All of the above

  2. How are use and require different?
    1. There are no differences, other than preference
    2. use is at compile time, require is at run time
    3. require is at compile time, use is at run time
    4. None of the above
    5. All of the above

  3. Which is true about extending Perl with CPAN packages (on a Unix/Linux system)?
    1. Only the system administrator may do so
    2. Individuals may add CPAN packages to his or her own directories
    3. CPAN may only be used if a group of at least three users vote for it
    4. All of the above
    5. None of the above

  4. What is true about sockets on the local machine (sometimes called Unix domain sockets)?
    1. They are used for interprocess communication
    2. They are only for ODBC/JDBC-style database connections
    3. They are only for CGI programs
    4. A and C above
    5. None of the above

  5. True or False: Only the Apache Web server offers CGI.
    1. True
    2. False

  6. If you write a Perl module (i.e., a .pm) file, can that module use or require other files, packages or modules?
    1. Yes
    2. No
    3. Only through CGI
    4. Only by the superuser ("root")

  7. What is true about formatting HTML output from a Perl CGI program?
    1. Most browsers only operate correctly without extra whitespace and returns
    2. Most users prefer HTML source code with a pink or reddish background color
    3. Extra whitespace and returns can make it easier to debug HTML
    4. All of the above
    5. None of the above

  8. Which statement about Perl's database interaction is correct?
    1. Perl can connect to most modern database systems
    2. MySQL is supported by Perl, but no other databases are
    3. Due to licensing issues, only open source database systems may be used by Perl
    4. All of the above
    5. None of the above

  9. What is Parrot?
    1. The pre-release code name for Perl 6
    2. A virtualizing module for Perl 6 and other purposes
    3. A virtual machine for Perl 6 and other purposes
    4. All of the above
    5. None of the above

  10. To display database query results, would you probably display fields in rows, or columns?
    1. Rows
    2. Columns
    3. On the diagonals
    4. All of the above
    5. None of the above

  11. How might mod_perl make database use more efficient?
    1. It will anticipate queries, and pre-cache search results
    2. It will maintain an open database handle
    3. It will create a socket between the user's browser, using ODBC
    4. All of the above
    5. None of the above

  12. Is it generally possible to run a Perl CGI program from the command line (instead of through the Web server)?
    1. Yes, provided the Web server is listening on port 8080
    2. Yes, but not until Perl 6 is officially released
    3. Yes, but output might not be formatted correctly since HTML is present
    4. Yes, but you must be "root"
    5. No

  13. What things must a Perl programmer be aware of when passing data structures to subroutines?
    1. Arrays of Arrays (AoA) are not permitted
    2. Subroutines will have their own local copy of variables
    3. Hashes of Arrays should be used whenever possible
    4. All of the above
    5. None of the above

  14. What is true about the time and times functions?
    1. time is for time of day, while times is for user and system time for a process
    2. time is for user and system time for a process, while times is for time of day
    3. time and times are the same in list context, but different in scalar context
    4. All of the above are incorrect
    5. None of the above is correct

  15. What is CGI::Carp useful for?
    1. Setting up secure sockets
    2. To provide more useful error output
    3. To maintain open file handles across CGI calls
    4. All of the above
    5. None of the above

  16. Programming exercise (15 points): "customer info." Parse a simple customer information file and generate a few sets of reports, on demand.

    Input: Use this comma-delimited plain text file: 205-final-input.csv. This file has three fields, separated by a pair of commas (by using two commas, it's feasible to have commas as part of data values). The first field is a name: firstname space lastname. The second field is a product name. The third field is a "1" if the item was shippped, and a "0" if the item has not yet been shipped.

    Write a Perl program to open and read the CSV file from disk (or over the network).

    Required output: Provide the user with a menu of choices to present each of the following types of output:

    1. A listing of all items not yet shipped
    2. A search for order status by typing a name (list items & whether they were shipped for that person)
    3. A count of items shipped and not yet shipped

    EITHER paste your program in the box provided, OR email it to Prof. Newby (newby AT arsc.edu). You do not need to submit a sample run, just the program. Points are awarded based on functionality, parsimony and legibility. Don't forget to Submit the rest of your exam using the button below.



This is the end of the exam. For the exam to be graded, first check your work above, then click the button below: