Web Programming Exam
April 28, 2005

I have not violated the Honor Code in completing this test.

Signed: ___________________________________________
READ THESE NOTES
Sign the pledge and initial each sheet. SHOW ALL YOUR WORK. Do as many questions as you are able.
DO NOT spend an excessive amount of time on any one question since all questions count the same.
You may OMIT any ONE question.
You MUST indicate which question is to be omitted by circling its number and writing the word OMIT next to it.
  1. How do privileges need to be set up so that html pages are accessible to web browsers? I.e, what user(s) need what privileges.




  2. Reorder the following, largest first
  3. Define a variant (class) of the P tag called P.indent that indents the first line (and only the first line) of a paragraph.







  4. How does one define the clickable areas of an image map?




  5. Give ONE LINE of html code that uses a named block of image map area definitions to implement an image map for an image named USA.gif



  6. Write a javaScript function that writes a group of radio buttons on a web page. The function will take 3 parameters. The first parameter is an array containing the value of each radio button. The second parameter is the number of radio buttons and the third parameter is the name of the group of radio buttons.

    function WriteRadio (Values(), numButtons, RadioName) {







    } //End Function

    A programmer writes a JavaScript function that checks to see if user-created passwords on a registration form are weak. Since the algorithm used to analyze the passwords contains clues about what passwords are acceptable the programmer hides the Javascript function in an include file.
  7. Explain why hiding the code in this manner is not a good idea.




  8. Describe a better way to hide the code that does the password check described above.
    HINT: Perhaps JavaScript is not the answer.




  9. Cite the likely cause of each of the following problems


  10. Give mySQL command line commands that will do the following
  11. A database administrator is given reponsibility for a database that she did not create named people. She has the root password for mysql. She wants to determine what tables exist in the database, how the tables are defined and what they contain. Explain completely and clearly how she may do this and give sample mysql commands to accomplish each of the functions referenced above.







  12. Give the HTML for a dropdown box that lists the state names, Virginia, Maryland, North Carolina, West Virgina and Delaware so that the value returned from selecting one of the states is VA, MD, NC, WV and DE respectively. The default option should be Virginia=VA.








  13. Write an HTML document that will do the following.
  14. Write a Javascript function named ValidateEmail that will accept one parameter, a string representing an email address. The function will return true if the parameter contains a string of 1 or more characters followed by an @ symbol followed by another string of 1 or more characters followed by a dot followed by another string of 1 or more characters.






  15. Write a complete PHP function named PwdCheck that accepts one parameter, a password. PwdCheck returns 0 if the password is between 7 and 24 characters long and contains no spaces. Otherwise it returns an integer error code indicating why the password is not acceptable.







  16. Give complete PHP code that will extract the form variables of the registration form and place them into PHP variables.




  17. Write a PHP file named DisplayRegInfo.php that will display the results of a user's registration as defined above formatted into a table.









  18. Write an SQL statement that will write the registration information (described above) into a new record in the mySQL table named CustInfo.




  19. Using the SQL statement above, write a complete PHP script called SaveRegInfo.php that will write the registration information into a new record in the mySQL table named CustInfo. in the myBusiness database located on localhost. The script may use the root account to write the record.





    A log file, named MyBusiness.log, is kept to record certain activities such as user registration in a web application. It is an ordinary text file and each line contains a description of the activity being logged (such as "registration" or "deleted record") and the date and time the activity occurred. The date and time are separated from the activity by a caret symbol (^).
  20. If the web root is located at c:\InetPub\wwwroot where should the log file be located and why?



  21. Write a php function named WriteLog that takes one parameter, a string representing the activity, and writes a record (as described above) to the log file, MyBusiness.log.