Consider the following program code:
%employees = ("Lucy", "Accounting", "Armando", "Finance",
"Adrienne", "Marketing");
delete($employees{"Lucy"});
Which of the following lines of code has the same effect as the preceding code?
Consider the following code:
%chars = ("a", "100", "b", "90", "c", "80");
Which one of the following choices will reverse the key/value pairing of the code?
Consider the following program code:
@stack = (10, 10..25);
push(@stack, yellow);
shift(@stack);
push(@stack, white);
print shift(@stack);
What is the result of executing this program code?
Consider the following code block:
BEGIN {print ("Jan ");}
BEGIN {print ("Feb ");}
END {print ("Mar ");}
END {print ("Apr ");}
Print ("May ");
What is the result of this code block?
Which one of the following choices will replace all occurrences of the word perl with the word Perl?
Consider the program code in the attached exhibit. What is the result of executing this program code?
Consider the following program code:
if ("cool" =~ m/[cool]{4}/)
{
print("True ");
}
else
{
print("False ");
}
if ("cool" =~ m/[col]{4}/)
{
print("True ");
}
else
{
print("False ");
}
What is the output of this code?
Consider the following program code:
$x = 0;
$y = 5;
do
{
print ($x $y );
}
while (++$x < 5 && ++$y < 10);
print ($x $y );
What is the result of executing this program code?
Which of the following choices demonstrates the correct syntax to pass a reference to a subroutine?
Consider that a file named test.txt contains this line of text:
One line of test text.
What is the output of the following lines of code?
$file = "test.txt";
open (OUT, "<$file") || (die "cannot open $file: $!");
seek(OUT, 15, 0);
read(OUT, $buffer, 5);
print $buffer . "\n";
print tell(OUT);
Consider the following program code:
print(1 );
BEGIN { print(2 ); }
END { print(3 ); }
BEGIN { print(4 ); }
END
{
package MyPackage;
print(5 );
}
What is the result of executing this program code?
Consider the following program code:
@array = (10, Masami, 10..13, Niklas);
for ($i = 1; $i < $#array; $i++)
{
print($array[$i] );
}
What is the result of executing this program code?
Consider the following code:
$_ = "New York";
@array2 = split(//);
What is the value of $array2[0] after the code is executed?
Which one of the following while statements uses correct syntax and expressions?
Which one of the following choices uses the correct syntax for a valid array assignment?
Consider the following command:
perl runme.pl arg1 arg2 arg3
Given this command issued on the command line, what is the value of $#ARGV?
Consider the following program code:
@array = ("ALPHA", "beta", "GaMmA");
sort(@array);
print("@array");
What is the output of this code?
Consider the following program code:
%color = (sun => yellow, apple => red);
reverse(%color);
@colorKeys = sort(keys(%color));
foreach(@colorKeys)
{
print($color{$_} . );
}
What is the result of executing this program code?
Yngve wants to define a character class that includes any alphanumeric word characters. Which one of the following choices is best suited for this requirement?
Consider the following assignments:
$x = 9
$y = 7
$z = 5
Given these assignments, which one of the following expressions evaluates as true?
Consider the following program code:
$y = 1;
$x = 2;
$z = 3;
do
{
print ($y );
} while ($y eq 2);
do
{
print ($x );
} until ($x eq 2);
print ($z );
What is the result of executing this program code?
Which one of the following while statements uses correct syntax and expressions?
Consider the following statement:
@array1 = (9, "A", 0..9, "PERL");
Given this statement, @array1 consists of how many elements?
Consider that a file named test.txt contains this line of text:
One line of test text.
What is the output of the following lines of code?
$file = "test.txt";
open (OUT, "<$file") || (die "cannot open $file: $!");
seek(OUT, 15, 0);
read(OUT, $buffer, 5);
print $buffer . "\n";
print tell(OUT);
Which one of the following choices will replace all occurrences of the word perl with the word Perl?
Consider the following program code:
@array = ("ALPHA", "beta", "GaMmA");
sort(@array);
print("@array");
What is the output of this code?
Consider the following lines of code:
1.$playerStr = "Today's player is Bob Petit.";
2.if($playerStr =~ /[Ruth|Gehrig|DiMaggio]/) {
3. $game = "Baseball";
4.}else{
5. $game = "Basketball";
6.}
7.print $game;
What is the output of these lines of code?
Which of the following code segments correctly readies a database query, creating a valid statement handle and a result set? Assume $dbh represents a valid database handle.
Consider the following program code:
$Animal = Dogs bark;
package Cat;
$Animal = Cats purr;
{
package Fish;
$Animal = Fish swim;
}
package main;
print $Animal;
What is the result of executing this program code?
Consider the following program code:
if ("Apple" gt "Pear")
{
print("True ");
}
else
{
print("False ");
}
if ("Banana" le "Banana")
{
print("True ");
}
else
{
print("False ");
}
What is the result of executing this program code?
Consider the program code in the attached exhibit. What is the result of executing this program code?
Consider the following program code:
$x = 150;
$y = "250";
if (($x + 100) == $y) { print("1 "); }
if ("250" == $y) { print("2 "); }
if ("250" eq $y) { print("3 "); }
if ($x lt $y) { print("4 "); }
if ($x ge $y) { print("5 "); }
What is the result of executing this program code?