• Home
  • Textbooks
  • CGI/Perl (Web Warrior Series)
  • Sending Data Using an Online Form

CGI/Perl (Web Warrior Series)

Diane Zak

Chapter 3

Sending Data Using an Online Form - all with Video Answers

Educators


Chapter Questions

Problem 1

$\mathrm{A}(\mathrm{n})$ _____________ variable can store precisely one value-typically a number or a string.
a. array
b. hash
c. scalar
d. singular

Check back soon!
01:02

Problem 2

Names of scalar variables begin with _____________.
a.@
b. *
c. &
d. None of the above.

Naresh Bagrecha
Naresh Bagrecha
Numerade Educator

Problem 3

The variable names $$\$ $$state and $$\$ $$State refer to the same location in the computer's internal memory.
a. true
b. false

Check back soon!
04:50

Problem 4

Which of the following statements creates a scalar variable named $$\$ $$height?
a. my ($$\$ $$ As Scalar);
b. my (Scalar &height);
c. my ($$\$ $$height as scalar);
d. None of the above.

Subash Charan
Subash Charan
Numerade Educator

Problem 5

When the name of a variable appears within double quotation marks in a statement, Perl uses a process referred to as _____________ to replace the variable's name with the variable's contents.
a. interpolation
b. replacement
c. substitution
d. None of the above.

Check back soon!
01:16

Problem 6

Which of the following statements prevents Perl from creating variables "on the fly"?
a. declare vars;
b. explicit declare;
c. use explicit;
d. use strict;

Ernest Castorena
Ernest Castorena
Numerade Educator
01:16

Problem 7

Which of the following statements assigns the name "Jack" to the $$\$employee$$ variable?
a. Semployee = Jack;
b. $$\$employee$$ = 'Jack';
c. $$\$employee$$ = "Jack";
d. both b and $c$

Ernest Castorena
Ernest Castorena
Numerade Educator
01:16

Problem 8

Which of the following statements assigns the message "Your name is Sue" to the $$\$ $$msg variable? (The $$\$ $$name variable contains the name "Sue".)
a. $$\$ $$ = Your name is $$\$name;$$
b. $$\$ $$ msg = 'Your name is $$\$name';$$
c. $$\$ $$msg = "Your name is $$\$name";$$
d. both b and c

Ernest Castorena
Ernest Castorena
Numerade Educator
01:15

Problem 9

Which of the following statements displays the message "The total due is $$\$ 78.50$$ " on a Web page? (Assume that the $$\$ $$ total variable contains the number 78.5.)
a. print "The total due is \$$total\n";
b. printf "The total due is \$%.2f\n, $total";
c. printf "The total due is \$%.2f\n", $total;
d. printf "The total due is \$total\n", %.2f;

Zack Spears
Zack Spears
Numerade Educator
06:34

Problem 10

Which of the following statements displays the message "Age: 35 " on a Web page? (Assume that the $$\$ $$age variable contains the number 35 .)
a. print "Age: $age\n";
b. printf "Age: %d\n", $age;
c. printf "Age: %d, $$\$ $$age\n";
d. both a and b

Samuel Goyette
Samuel Goyette
Numerade Educator

Problem 11

What are the three basic data types for Perl variables?

Check back soon!
11:29

Problem 12

Write a variable declaration statement that declares four variables named $$\$employee$$, $$\$age$$, $$\$payrate$$, and $$\$name$$.

RO
Reynald Oliveria
Numerade Educator

Problem 13

Write an assignment statement that assigns the number 5.5 to the payrate variable.

Check back soon!

Problem 14

Write an assignment statement that multiplies the contents of the spayrate variable by 2 , and then assigns the result to the $payrate variable.

Check back soon!

Problem 15

15. Write an assignment statement that assigns the contents of the employee variable to the sname variable.

Check back soon!
11:29

Problem 16

Write an assignment statement that assigns the message "The employee of the month is "followed by the contents of the employee variable to the name variable.

RO
Reynald Oliveria
Numerade Educator

Problem 17

Write an assignment statement that assigns the message "The name is stored in " followed by the variable name employee to the name variable.

Check back soon!
01:21

Problem 18

Assume that a text box included on a form is named Hours. Write an assignment statement that stores the text box value in a scalar variable named $$\$ $$ hours. (You can assume that the script uses the CGI.pn module to parse the form data.)

Willis James
Willis James
Numerade Educator
11:29

Problem 19

Write a statement that displays the message "Your gross pay is $$\$ 650.00$$." on a Web page. The gross pay amount (650) is stored in the gross variable.

RO
Reynald Oliveria
Numerade Educator
11:29

Problem 20

Modify the statement that you created in Question 19 so that it displays the message "Your gross pay is $$\$ 650.00$$ and your net pay is $$\$ 615.30$$." The net pay amount (615.3) is stored in the net variable.

RO
Reynald Oliveria
Numerade Educator