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?
Answer : C
[Note] /[ Ruth|Gehrig|DiMaggio ]/ <=> /[ RuthGehrigDiMaggio ]/
don't confuse with /( Ruth|Gehrig|DiMaggio )/
Consider the following program code
@array = ("Y","W"1"X");
array = sort(@ array);
unshift(@array, "Z");
print(@array[0]);
What is the output of this code?
Answer : D
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?
Answer : C
Which one of the following choices uses the correct syntax for a valid array assignment?
Answer : D
Which line of code represents the correct syntax to establish a reference to a database handle?
Answer : D
Consider the following program code:
$x = 10;
LOOP: while ($x < 15)
{
print ($x );
if ($x >= 14 && $x <= 20)
{
$x += 2;
redo LOOP;
}
else
{
$x++;
}
What is the result of executing this program code?
Answer : B
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?
Answer : C