Ques 1:
What is -> Symbol in Perl?
a) '->' symbol is used to refer hash values
b) In object oriented PERL the arrow -> symbol is used for creating or accessing a particular object of a class
c) Arrow operator -> is used for dereferencing references to array or hash
e.g $arr = ['1', '2' ,'3', '4'];
To retrieve the value of first element:
$val = $arr->[1];
d) All of the above are correct
Ques 2:
How do you open a file for writing?
a) open (”FH”, “>filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.
b) open (”FH”, “<filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.
c) open (”FH”, “filename.dat”) || die “Can’t create the file\n”; Later use FH to perform all file related operation.
d) All are same.
Question 1:The correct answer is b).If you have an object $a of class MyClass, and classMyClass has property "prop", and method "meth", then one
can access to them as follows:
$a->prop
$a->meth()
Question 2:
The correct answer is a), where symbol ">"is used.
In the case b), with symbol "<" file will beopened for reading,
while case c) is incorrect.
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
Perl