1 Which of the following operators is used to read files? a. !-- b. < > c. ## d.
ID: 3750654 • Letter: 1
Question
1 Which of the following operators is used to read files?
a.
!--
b.
< >
c.
##
d.
$$
2. Which of the following is used to identify a subroutine?
a.
@
b.
$
c.
&
d.
#
3. Which of the following is the Perl string concatenation operator?
a.
+ (plus)
b.
: (colon)
c.
. (dot)
d.
- (hyphen)
4. How many errors are in the following program?
# /usr/bin/perl
print "Enter the block size of your file system: "
bs = <STDIN>;
chop ($bs);
if ($bs > 8192)
print "Lot of wasted space ";
} else {
print "Reasonable size";
}
a.
4
b.
5
c.
6
d.
7
Explanation / Answer
1. b.< >
open(readData, "<file.txt")
while(<readData>) {
print "$_";
}
2. c.&
&mysubroutine;
3. c. . (dot)
my $z = $x . ' ' . $y;
4. a. 4
semi-colon missing end of the first line
$ symbol missing at the start of the second line
open bracket missing after if
closing bracket missing of else block
Let me know if you have any queries or clarifications.... :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.