Professional Documents
Culture Documents
PERL PROGRAMMING
PRE TRAINING QUESTIONNAIRE
Name
:
Designation:
Allotted Time: 20 mins.
TOTAL MARKS
OBTAINED / 20
=
NOTE: 1. More than one correct answer is possible & should be
selected/marked
2. Partial answers will NOT be awarded points
1. #!/usr/bin/perl -w the -w argument with Perl programs defines ?
a. error message
b. warnining
c. sha bang
d. invalid option -w
2. "fred" x 3 this statement return_________
a. fred
b. fredfred
c.fredfredfred
d.fred,fred,fred
3. $x = "hello world"; chop($x); ______
a. hello world
b. hello worl
c. hello world \n
d. invalid error
4. push(@mylist,$newvalue); is equivalent to _________
a. @mylist = (@mylist,$newvalue)
b. @mylist = ($newvalue,@mylist)
5. /\b Fred\b/; matches_
a.fred
b.Fred
c.fredrick
d.alFred
Post-Training Assessment Sheet
a. True
b. False
15. $#ARGV is the subscript of the last element of the @ARGV array
a. True
b. Flase
16. $str = 'The cat sat on the mat';
$str =~ tr /a/o/;
print $str;
the above code will print
a. The cat sat on the mat
b. THE CAT SAT ON THE MAT
c. The cot sot on the mot
d. The cot sat on the mat
17. perl regular expression + pattern will matches 1 or more
occurence of preceding expression
a. True
b. False
18. [^aeiou] pattern search is____________?
a. match any of ASCII letter
b. match any of aeiou lower case letter
c. match anything other than ASCII
d.match anything other than a lowercase vowel
19. 1.
2.
4.
5.
6.
7.
8.
package pgk;
sub new {
my $this={};
bless $this;
return $this ;
}
1;
package pgk;
sub new {
my $this={};
bless $this;
return $this ;
}
Training Assessment Sheet
8. 1;
The same code, 5th line the bless() function takes that reference
to $this and tells the object it references that it's now pgk and then
returns the reference.
a. Yes
b. No , it's in valid reference.