You are on page 1of 4

Rely-on Solutions

(Corporate Training Cell)


20, Sant Nagar, East of Kailash,
www.rely-ongroup.com

PERL PROGRAMMING
PRE TRAINING QUESTIONNAIRE
Name
:
Designation:
Allotted Time: 20 mins.

Max. Marks Allotted: 20


For Official
Purposes

(Tick the correct answers)

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

6. ^x|y matches x ______ or y_________


a. beginning of the line y anywhere
b. end of the line y end of the line
c. beginning of the line , y does not placed
d. invalid pattern
7.A hash variable name is a percent sign _____
a. @
b. %
c. $$
d. &
8. %copy = %original; _________
a. copy from %original to %copy
b. copy from %copy to %original
9. from the below which one is print 5hello?
a. print (2+3),"hello";
b. print ((2+3),"hello");
10. last statement is equivalent to _____
a. break
b. continue
c. endof statement in the array
d. invalid statement
11. How to check file existing or not using file test
a. -r
b. -w
c. -x
d. -e
12. $var=10;
$var1=\$var;
print $var1________
a.10
b.empty line
c.address of $var
d.address of $var1
13. The DESTROY method will be called on the object just before
Perl frees the memory allocated to it.
a. True
b. False
14. $@array return length of array
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;

From the above pgk package


reference to an empty hash.
a. Yes
b. No
20. 1.
2.
4.
5.
6.
7.

, the 3rd line {} constructs a

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.

Training Assessment Sheet

You might also like