Consider the following statement:
$buffer = a string;
Also consider that a file named test.txt contains the following 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: $!");
read(OUT, $buffer, 15, 4);
print $buffer;
Answer : B
Consider the following lines of code:
@array1 = ("apples", "oranges", "pears", "plums");
foreach (@array1) {print "$_\n"};
What is the result of these lines of code?
Answer : D
Consider the following program code:
%hash = (small => 8oz,
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?
Answer : C
Which statement will print the capital attribute of the $kansas object?
Answer : D
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?
Answer : A