Question: Perl identifiers that hold a single value (number or string) should begin with a 1) $ 2) # 3) @ 4) % Suppose a Perl

Perl identifiers that hold a single value (number or string) should begin with a

1)

$

2)

#

3)

@

4)

%

Suppose a Perl program is started from the bash command line on a Linux system as below.

./p1.pl A B C D

Which of the following variables contains "A"?

1)

$ARGV[-1]

2)

$ARGV[0]

3)

$ARGV[1]

4)

$ARGV[2]

What is the difference between eq and =~i in Perl?

1)

eq looks for equality and =~ means pattern matching

2)

=~ looks for equality and eq means pattern matching

3)

Both operators are equivalent

4)

There is no eq operator in Perl

Perl supports matching against regular expressions.

1) True
2) False

Which of the following functions can be used to divide a string into individual tokens in Perl?

1)

convert

2)

divide

3)

split

4)

tokenize

Consider the following Perl code fragment for the next two questions.

$line = "128.78.12.9";

($p1, $p2) = split('\.', $line);

What does the variable $p1 contain after the code fragment completes execution?

1)

128

2)

78

3)

12

4)

9

What does the variable $p2 contain after the code fragment completes execution?

1)

128

2)

78

3)

12

4)

9

Perl statements must be terminated by

1)

.

2)

:

3)

$

4)

;

The Perl statement

open(FILE, $line):

1)

opens a file for appending

2)

opens a file for writing

3)

opens a file for reading

4)

opens a file for reading and writing

A while loop in Perl

1)

always executes a fixed number of times

2)

continues to iterate while the condition specified in the while statement remains false.

3)

continues to iterate while the condition specified in the while statement remains true.

4)

continues to iterate while there is a line in some file to read.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!