Networking Chapter 9 1 Describe the types of tasks in which Perl is frequently used

subject Type Homework Help
subject Pages 6
subject Words 1149
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 9: PERL AND CGI PROGRAMMING
TRUE/FALSE
1. The .pe extension is typically used to indicate that the file is a Perl script.
2. The value of a variable can change while a program runs.
3. In Perl, double-quoted strings are not subject to interpolation.
4. The Awk program does not require the programmer to explicitly set up looping structures as does Perl.
5. Awk is popular as a CGI tool for Web-based applications.
MULTIPLE CHOICE
1. Perl is a(n) ____ language, which means that statements are read and immediately executed.
a.
interpreted
c.
compiled
b.
object-oriented
d.
fourth generation
2. All complete statements in Perl end with a(n) ____.
a.
colon
c.
comma
b.
semicolon
d.
asterisk
3. A(n) ____ is a simple variable that holds a number or a string.
a.
label
c.
scalar
b.
constant
d.
identifier
4. Scalar variable names begin with a(n) ____.
a.
dollar sign ($)
c.
pound sign (#)
b.
asterisk (*)
d.
exclamation sign (!)
5. ____ are sequences of any types of characters (including numbers that are treated as characters rather
than digits).
a.
Scalars
c.
Variables
page-pf2
b.
Strings
d.
Constants
6. The character sequence ____ forces the next character to uppercase.
a.
\u
c.
\
b.
\U
d.
\Q
7. The character sequence ____ quotes all following nonalphanumeric characters until \E is encountered.
a.
\u
c.
\
b.
\U
d.
\Q
8. ____ are variables that store an ordered list of scalar values that are accessed with numeric subscripts,
starting at zero.
a.
Strings
c.
Lists
b.
Arrays
d.
Hashes
9. When processing the individual elements of an array, use the ____ character.
a.
@
c.
$
b.
#
d.
*
10. A(n) ____ is a variable that represents a set of key/value pairs.
a.
string
c.
tuple
b.
array
d.
hash
11. To refer to a single element of a hash, you use the $ character before the variable name, followed by
the key associated with the value in ____.
a.
parentheses
c.
square brackets
b.
curly brackets
d.
angle brackets
12. The following example shows a(n) ____ variable:
%animals = (’Tigers’, 10, ’Lions’, 20, ’Bears’, 30);
a.
array
c.
hash
b.
scalar
d.
string
13. If the ____ option is not included, the Awk program uses the first command-line argument as its
program.
a.
-I
c.
-F
b.
-i
d.
-f
page-pf3
14. The convention is to use all uppercase letters for ____.
a.
variables
c.
strings
b.
constants
d.
filehandles
15. In Perl, print; is equivalent to ____.
a.
print "$_";
c.
print "_";
b.
print "$";
d.
print "_$";
16. In Perl, the logical OR operator is ____.
a.
<>
c.
||
b.
<=>
d.
|
17. After you create a Web page, you can publish the page on a Web ____.
a.
program
c.
server
b.
database
d.
client
18. The ____ feature allows your UNIX or Linux system to access its own internal network configuration
instead of an external network.
a.
spaceship
c.
netstat
b.
loopback
d.
ifconfig
19. The IP address ____ is the standard designation for loopback communications.
a.
192.168.0.1
c.
255.255.255.255
b.
10.0.0.0
d.
127.0.0.1
20. The name of the computer at the loopback address is ____.
a.
localhost
c.
default
b.
host
d.
root
21. In HTML, all special codes contained inside angled brackets <> are ____.
a.
commands
c.
tags
b.
constants
d.
variables
COMPLETION
1. ____________________ Language (Perl) is a free script language that runs on many operating
systems, including UNIX, Linux,Windows, and Mac OS X.
page-pf4
2. ____________________ are symbolic names that represent values stored in memory.
3. The <> symbol is called the ____________________ operator.
4. The <=> sort operator, known as the ____________________ operator, reduces coding requirements.
5. You can create a Web page using ____________________ (HTML).
6. A(n) ____________________ is text or an object that,when clicked, loads another document and
displays it in the browser.
MATCHING
Math each item with a statement below.
a.
\n
f.
#
b.
$name
g.
==
c.
@
h.
%
d.
\
i.
ne
e.
<>
1. marks the beginning of a comment in Perl
2. used to perform a line feed
3. a variable in Perl
4. in Perl, tests two numeric values for equality
5. one of Perl’s string relational operators
6. in Perl, when it precedes a variable name, it indicates it should not be interpolated
7. in Perl, precedes the name of an array when assigning it values
8. in Perl, precedes a hash variable, when it is assigned values
9. returns the next line from a file (after it has been opened)
page-pf5
SHORT ANSWER
1. Describe the types of tasks in which Perl is frequently used.
2. What is a compiled language?
3. How do you read input from the keyboard in Perl?
4. What is a constant?
5. What is a floating-point value?
page-pf6
6. What is a filehandle?
7. How can you sort @somelist and store the result in @sortedlist?
8. What is a subroutine?
9. What is a Web server?
10. What are the two parts of the code of a Web (HTML) page?
11. What is CGI?

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.