Final - Chapter 9 Flashcards
1
Q
- Which of the following describes Common Gateway Interface (CGI). (Choose all
that apply.)
a. It facilitates the exchange of information over theWeb.
b. It is a specialized interface for using Java scripts only.
c. It is a security program to protect a server.
d. It is a protocol or set of rules.
A
A and D
2
Q
- Your colleague is writing a Perl script and wants to determine if two strings are the same. He used the = operator, but it is not working properly. What is the problem?
a. He should use the ! = operator, instead.
b. He did not surround the strings with square brackets to show they are strings.
c. He should use the eq operator, instead.
d. He should use , instead.
A
C
3
Q
3. In Perl a variable that starts with $, such as $value, . (Choose all that apply.) a. cannot be zero b. can be numeric c. can be nonnumeric d. is scalar
A
B,C,D
4
Q
4. Which of the following operators is used to access data in an open file in Perl? (Choose all that apply.) a. # b. @ c. ( ) d. <>
A
B and D
5
Q
- You are training a new employee and have been asked to help him learn Perl. Which of the following statements can you use to help describe Perl? (Choose all that
apply. )
a. It is only used on UNIX and Linux systems.
b. It is popularly used to create reports, such as business reports.
c. It is a language that requires compiling.
d. It can be used to manipulate text and numeric information.
A
B and D
6
Q
- You have created the following expression in Perl: $value < 2842.What does this expression mean?
a. The size of the value file is 2842 kilobytes.
b. The file 2842 is opened and given the name value for the purpose of the current
Pearl script.
c. The variable value is less than 2842.
d. 2842 is written to the file called value.
A
C
7
Q
- A programmer in your group has written the following subroutine, which does not work. What is the problem?
run sort { if ($a < $b) { -1; } elsif ($a == $b) { 0; } else { +1; } }
A
He should replace “run” with “sub.”
8
Q
- One of your colleagues has written a Perl script, but it does not run on some people’s computers who use a different Linux distribution or who do not use the Bash shell. Which of the following might be the problem?
a. The script does not have a beginning line that contains the path to Perl, such as #!/usr/bin/perl. b. Perl can only be run in the Bash shell. c. The script does not contain the line to specify it is a Perl script, which is make= perl. d. Perl does not run in the root account, which must be the account some users are accessing to run this Perl script.
A
A
9
Q
- A colleague at work has overheard you discussing the spaceship operator and is curious
about what this is.What do you tell him?
a. It refers to a Perl script that has bugs.
b. It deletes one or more files in Perl.
c. It is a Perl formatting editor that helps speed the writing of Perl scripts.
d. It performs numeric sorts in Perl.
A
D
10
Q
- You are writing a Perl script that uses a segment of code over and over again,
and you are tired of repeatedly typing in this code.Which of the following should
you do?
a. Create a subroutine.
b. Use the =+= repeat operator.
c. Use the ++ operator.
d. Create a repeat script.
A
A
11
Q
- Which of the following are automatically opened by Perl? (Choose all that apply.)
a. A.OUT
b. STDOUT
c. STDERR
d. CORE
A
B and C
12
Q
- In the following statement, when is “Could not open students file” displayed?
open (FILEIN, “students”) || warn “Could not open students
file \n” ;
a. When open (FILEIN, “students”) is false.
b. When open (FILEIN, “students”) is true.
c. When the last row of data has been read from the students file.
d. When the students file is larger then 1.5 MB.
A
A
13
Q
- When you make aWeb page using HTML, what line do you start with to show that
what follows after that line consists of HTML tags?
a. #START
b. /NEW
c.
d. /BEGIN/
A
C
14
Q
- Which of the following is an example of a scalar? (Choose all that apply.)
a. $income = 62,859;
b. $lname = “McGregor”;
c. value = 10,Tiger;
d. @cell* = B10;
A
A and B
15
Q
- You have written the following line in a Perl program:
$filein = $ARGV[0];
What is the purpose of this line?
a. It copies a file to the ARGV directory.
b. It closes a file.
c. It searches for a file in all subdirectories under a directory.
d. It saves the name of a file passed from the command line in ARGV[0].
A
D
16
Q
- In Perl, the control sequence \n is used to .
a. designate a horizontal tab
b. designate a new line
c. force the next character to be lowercase
d. make a bell sound
A
B