Question No : 1
Consider the following code block:
BEGIN {print ("Jan ");}
BEGIN {print ("Feb ");}
END {print ("Mar ");}
END {print ("Apr ");}
Print ("May ");
What is the result of this code block?
A. Jan Feb May Apr Mar
B. Jan Feb Mar Apr May
C. Mar Apr May Jan Feb
D. May Jan Feb Mar Apr
Answer: A
Question No : 2
Which one of the following choices will replace all occurrences of the word perl with the
word Perl?
A. s/Perl/perl/I;
B. s/"perl"/"Perl"/g;
C. s/"perl"/"Perl"/;
D. s/perl/Perl/g;
Answer: D
Question No : 3
Consider the following program code:
1.$x = 100;
2.$y = "-25";
3.$sum = $x + $y;
4.
5.print $sum;
What is the result of executing this program code?
A. The code will output the following:
100-25
B. The code will output the following:
75
C. The code will fail at line 3 because $y contains string data.
D. The code will output the following:
125
Answer: B
Topic 1, B
Question No : 4
Which one of the following choices lists only valid expression operators?
A. + - ** //
B. * ** / //
C. ** / ++ %
D. */ % -- **
Answer: C
Question No : 5
Consider the following lines of code:
$_ = "This is a test";
s/^([^ ]*)\s*([^ ]*)/$2 $1/;
print;
What is the output of these lines of code?
A. h Tis a test
B. is This a test
C. i Thiss a test
D. his T is a test
Answer: B
No comments:
Post a Comment