CIW 1D0-437 - CIW PERL FUNDAMENTALS Exam
Page: 1 / 30
Total 149 questions
Question #1 (Topic: Topic 0)
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;
$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;
A. a strOne line of test
B. a stOne line of tes
C. a strOne line of tes
D. a stOne line of test
Answer: B
Question #2 (Topic: Topic 0)
Consider the following lines of code:
@array1 = ("apples", "oranges", "pears", "plums");
foreach (@array1) {print "$_\n"};
What is the result of these lines of code?
@array1 = ("apples", "oranges", "pears", "plums");
foreach (@array1) {print "$_\n"};
What is the result of these lines of code?
A. applesorangespearsplums
B. apples oranges pears plums
C. apples
D. apples oranges pears plums
Answer: D
Question #3 (Topic: Topic 0)
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?
%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
Answer: C
Question #4 (Topic: Topic 0)
Which statement will print the capital attribute of the $kansas object?
A. print ("capital"=>$kansas);
B. print {$kansas}=>(capital);
C. print (capital)<={$kansas};
D. print $kansas->{"capital"};
Answer: D
Question #5 (Topic: Topic 0)
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?
@array = (10, Masami, 10..13, Niklas);
for ($i = 1; $i < $#array; $i++)
{
print($array[$i] );
}
What is the result of executing this program code?
A. The code will output the following: Masami 10 11 12 13
B. The code will output the following: 10 Masami 10 11 12 13
C. The code will output the following: 10 Masami 11 12 13 Niklas
D. The code will output the following: Masami 10 11 12 13 Niklas
Answer: A