Write a perl cgi program script to insert new questions


Download and install MySQL, Perl and its relevant modules, and a webserver on your machine if they are not available on your system.

The software and relevant installation instructions are available at Canvas (Online Learning Tool) site https://canvas.umd.umich.edu/.

Assume that the following table:

quiz1 tst ( qnumber INTEGER,

question VARCHAR(80),

answer VARCHAR(20),

choice1 VARCHAR(20),

choice2 VARCHAR(20),

choice3 VARCHAR(20),

choice4 VARCHAR(20),

choice5 VARCHAR(20) )

is created on the MySQL database server and is used to keep questions in a quiz.

Assume that the database name is cmp265db, the user id is cmp265, and password is cmp265pwd.

Write a Perl CGI program (script) to insert new questions into the quiz table via a Web browser. You can assume that, when inserting questions into the table, there is only one transaction yielded by your program to access the table (i.e., no need to consider concurrency control issues).

Some detailed requirements are given as follows:

• The question number (‘qnumber') of a new question must be numbered in a consecutive order with the existing questions (if any) in the table. For example, if the current table has 3 questions, your next new question should be numbered as the 4th one.

• Each session can insert multiple questions into the table. You need to display how many questions exist in the table and how many new questions you have inserted for the current session on the browser.

• Keep your state data in a state table (with a table name states xxx, where xxx is your last name using all lower-case letters) managed by the MySQL database server.

• Keep the names of your quiz table and state table in two global variables so that they can be easily changed when the program is tested for tables with other names if necessary.

• Make sure your program performs sufficient error checking.

• Put sufficient comments in the program so that it is easy to understand.

• Print the screen snapshots of several sessions, and print the contents of your quiz table and state table after each session.

• Print the screen snapshots of a quiz session using the quiz CGI program quiz3 tst.pl (which can be downloaded from Canvas) for the quiz table with your newly-inserted questions (after one insertion session). Note that quiz3 tst.pl is the same as quiz3.pl that we discussed in the class except that the name of the quiz table has been changed to quiz1 tst that is used by your quiz inserting program.

• Write a description document about your program, including its transaction diagram.

Attachment:- example_scripts.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a perl cgi program script to insert new questions
Reference No:- TGS01204637

Expected delivery within 24 Hours