What will be the output from the given statement?
Consider the following statement:
for ($count=0; $count < 5; $count++) {print “$count “}
What will be the output from the given statement?
What is the output of this code?
Consider the following program code:
$var = 10;
package Alpha;
$var = 20;
{
package Beta;
$var = 30;
}
package Gamma;
$var = 40;
{
print $var;
}
What is the output of this code?
What is the output of the following lines of code?
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);
What is the result of executing this code?
Consider the following code:
%hashA = (“alpha”, “beta”, “gamma”, “alpha”);
%hashA = reverse(%hashA);
print $hashA{“alpha”};
What is the result of executing this code?
what is the value of $#ARGV?
Consider the following command
perl1 runme.pl arg1 arg2 arg3
Given this command issued on the command line, what is the value of $#ARGV?
What is the value of $array2[0] after the code is executed?
Consider the following code:
$_ = “New York”;
@array2 = split(//);
What is the value of $array2[0] after the code is executed?
What is the result of executing this program code?
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?
What is the result of executing this program code?
Consider the following program code
%hash = (“small” -> “Boz”,
“medium” => “16oz”,
“large” => “32oz”);
@keys = sort(keys(%hash));
for ($i = 0; $i < 3; $i++) {
print(“$hash{$keys[$i]}\n”);
}
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?
Which of the following choices demonstrates the correct syntax to pass a reference to a
subroutine?
What is the result of executing this program 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?