What is the result of executing this program code?

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?

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?

A.
The code will fail at line 1 because a hash cannot contain both numeric and string data

B.
The code will execute without error but will output nothing.

C.
The code will output the following: 32oz 16oz 8oz

D.
The code will output the following large medium small



Leave a Reply 0

Your email address will not be published. Required fields are marked *