Sie sind auf Seite 1von 33

Scenario You have read a text file containing whitespace separated columns of numbers.

Each line may contain leading and trailing whitespace. You must iterate through the file and, for each line, capture the numbers in an array. The elements of the array must not contain leading or trailing space and there may be no empty elements. Based on the scenario above, which split command might you use in your loop to meet the specification? Choice 1 my @fields = split / /, $string; Choice 2 my @fields = split /\s/, $string; Choice 3 my @fields = split /\s+/, $string; Choice 4 my @fields = split ' ', $string; Choice 5 my @fields = split /\s*/, $string; Perl 5.12, Question 1 of 20 -----------===== Sample Code $f = 4; for $f (1, 2, 3) { print $f; } print $f; Based on the sample code above, what is printed? Choice 1 123 Choice 2 4444 Choice 3 1233 Choice 4 1234 Choice 5 Nothing; the script exits with an error. Perl 5.12, Question 2 of 20

Sample Code $x = (2, 4, 6); Based on the sample code above, what will $x equal after the assignment? Choice 1 2 Choice 2 3 Choice 3 6 Choice 4 undef Choice 5 An empty string Perl 5.12, Question 3 of 20

What statement would open a file for both reading and writing? Choice 1 open( my $fh, '>>', $filename ) or die $!; Choice 2 open( my $fh, '<>', $filename ) or die $!; Choice 3 open( my $fh, 'rw', $filename ) or die $!; Choice 4 open( my $fh, '+<', $filename ) or die $!; Choice 5 open( my $fh, '<+', $filename ) or die $!; Perl 5.12, Question 4 of 20

What expression is equivalent to pop(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1); Choice 5 splice(@data,0,0,1); Perl 5.12, Question 5 of 20

Sample Code

Based on the sample code above, what is the output? Choice 1 1 Choice 2 135 Choice 3 357 Choice 4 11357 Choice 5 13571 Perl 5.12, Question 6 of 20

What is the /x regular expression modifier used for? Choice 1 It permits the use of the extended patterns including stable look-around assertions. Choice 2 It permits use of experimental regular features such as the (?{ code }) and (??{code}) assertions. Choice 3 It permits the use of Posix character classes. Choice 4 It results in the regular expression being evaluated as a double quoted string before the engine performs any matching. Choice 5 It permits the use of white space and comments in order to make regular expressions more readable. Perl 5.12, Question 7 of 20

Scenario You have a generalized routine that you want to distribute so it can be used in other code. Based on the scenario above, how do you distribute your code? Choice 1 Create a header file. Choice 2 Create a POD file. Choice 3 Create a library file. Choice 4 Create a Perl module. Choice 5 Create a object file. Perl 5.12, Question 8 of 20

Which type of Perl variable can be used as an object? Choice 1 Any type of variable Choice 2 Only scalars Choice 3 Only arrays Choice 4 Only hashes Choice 5 Only subroutine references Perl 5.12, Question 9 of 20

Sample Code open(FH, "+>", undef) Based on the sample code above, the code opens a: Choice 1 file for read/write access, but it first clears any existing information in the file. Choice 2 file for read access. Choice 3 filehandle to an anonymous temporary file. Choice 4 file for read/write access, appending new data to the end of the file. Choice 5

filehandle to in-memory files held in a scalar. Perl 5.12, Question 10 of 20

Scenario You have a file containing records terminated by the string "EOR". above, what tells Perl how to read in a single record at a time? Choice 1 $/="EOR"; Choice 2 $|="EOR"; Choice 3 $$="EOR"; Choice 4 $"="EOR"; Choice 5 $&="EOR"; Perl 5.12, Question 11 of 20 Based on the scenario

Sample Code

Based on the sample code above, what statement produces equivalent output? Choice 1 print map {return "$_\n";} 0..9; Choice 2 print map {"$_";} (0,1,2,3,4,5,6,7,8,9); Choice 3 map {print "$_\n";} 1..9; Choice 4 print map {"$_\n";} 0..9; Choice 5 map {print "$_\n";} 0..10; Perl 5.12, Question 12 of 20

Sample Code

Based on the sample code above, what change is needed to correct it? Choice 1 Change line 3 to \@LoL[$i] = \@list; Choice 2 Change line 3 to $LoL[$i] = @list; Choice 3 Change line 3 to $LoL[$i] = scalar @list; Choice 4 Change line 3 to @LoL[$i] = @list; Choice 5 Change line 3 to $LoL[$i] = [ @list ]; Perl 5.12, Question 13 of 20

Sample Code print 4 - 1 / 2 + 8; Based on the sample code above, what would be printed? Choice 1 0.3 Choice 2 9.5 Choice 3 3.9 Choice 4 11.5 Choice 5 -4.5 Perl 5.12, Question 14 of 20

How are variables kept unique in modules? Choice 1 They have the package name added to them. Choice 2 They are lexically localized. Choice 3 They are pushed to the stack when the module ends and popped off the stack when the module is entered. Choice 4 They have a modifier that associates them with the module.

Choice 5 They have a private heap per module. Perl 5.12, Question 15 of 20

Sample Code Based on the sample code above, what is the item in line 2? Choice 1 A hash that contains 'Wed' Choice 2 An array that contains 'Mon','Tue','Wed','Thurs','Fri' Choice 3 A scalar that contains 'Thurs' Choice 4 A scalar that contains 'Wed' Choice 5 A scalar that contains 5 Perl 5.12, Question 16 of 20

What is one important difference between the "use" statement and the "require" statement? Choice 1 Use statements can only be used to include modules; require statements cannot be used to include modules. Choice 2 Require statements can only be used to include modules; use statements cannot be used to include modules. Choice 3 Use statements are evaluated at run time; require statements are evaluated at compile time. Choice 4 Use statements are evaluated at compile time; require statements are evaluated at run time. Choice 5 Require statements can have an import list; use statements always import all the symbols exported by the module. Perl 5.12, Question 17 of 20

How do you create a subroutine that accepts a scalar value? Choice 1 sub routine($var) [ ];

Choice 2 sub routine (my $var) { } Choice 3 sub routine {my ($var)=@_;} Choice 4 my sub routine(local $var) { }; Choice 5 sub routine(*var) {}; Perl 5.12, Question 18 of 20

Sample Code my $p = 0; my $q = 1; my $r = undef; if ($p and $q) { print "p and q are true."; } else if ($q and $r) { print "q and r are true."; } else if ($p or $q or $r) { print "at least one of p, q, and r is true."; } else { print "p, q, and r are all false."; } Based on the sample code above, what is printed? Choice 1 p and q are true. Choice 2 q and r are true. Choice 3 at least one of p, q, and r is true. Choice 4 p, q, and r are all false. Choice 5 Nothing is printed; the code exits with an error. Perl 5.12, Question 19 of 20

Which regular expression deletes all tags specified as text, enclosed by "<" and ">", from a document stored in a string, but deletes nothing else. Choice 1

$string =~ s/<*&>//sg; Choice 2 $string =~ s/<.*>//sg; Choice 3 $string =~ s/<\S*>//sg; Choice 4 $string =~ s/<.*?>//sg; Choice 5 $string =~ s/<\s*>//sg; Perl 5.12, Question 20 of 20

Sample Code

Based on the sample code above, what does the line in the printSorted subroutine that retrieves the parameters probably look like? Choice 1 my (@data,@options) = @_; Choice 2 my (@data,$options) = @_; Choice 3 my ($data,%options) = @_; Choice 4 my ($data,$option1,$option2) = @_; Choice 5 my ($data,$options) = @_; Perl 5.12, Question 1 of 20

what is the output will be?

Scenario You are writing a Perl module that reports statistics on a particular operating system. Based on the scenario above, what allows you to check the operating system and limit the Perl module to run only on a specific operating system? Choice 1 use OSCheck; Choice 2 use Config; Choice 3 use OSVer qw(OS_GOES_HERE); Choice 4 die unless ("$OS" == "OS_GOES_HERE"); Choice 5 exit 1 if ("$OSVER" != "5.9");

Perl 5.12, Question 3 of 20

Sample Code

Based on the sample code above, what replacements for ???? cause the code to print 14? Choice 1 (2, (1..4, 6), 1) -------19 Choice 2 (4..1, 4) -----------------4 Choice 3 (4, (1..3, 3), 1) -------------14 Choice 4 1..5 ----------------------15 Choice 5 [2, (1..4, 6), 1] ------------------ 3444036 Perl 5.12, Question 4 of 20

Sample Code

Based on the sample code above, how do you change the code so that it allows the class to be used when it is inherited? Choice 1 Change line 1 to "sub new (inherit==1)". Choice 2 Change line3 to "my ($class, %args, $inherit=1) = @_;". Choice 3 Change line 4 to "bless inherit { _name => $args{name},". Choice 4 Change line 7 to "}, ref($class)||$class;". Choice 5 Change line 1 to "sub new (inherit=>1)". Perl 5.12, Question 5 of 20

Sample Code

Based on the sample code above, what prints? Choice 1 11 12 13 Choice 2 1 2 3 Choice 3 1..1 1..2 1..3 Choice 4 1 12 123 Choice 5 1 21 321 Perl 5.12, Question 6 of 20

Sample Code Based on the sample code above, what is the item in line 2? Choice 1 A hash that contains 'Wed' Choice 2 An array that contains 'Mon','Tue','Wed','Thurs','Fri' Choice 3 A scalar that contains 'Thurs' Choice 4 A scalar that contains 'Wed' Choice 5 A scalar that contains 5 Perl 5.12, Question 7 of 20

Sample Code print map {"$_ -> $hash{$_}"} sort {$a cmp $b} keys %hash; Based on the sample code above, what is the printed output? Choice 1 Associative array elements in which the keys are lexically greater than the values Choice 2 An associative array's key-value pairs sorted by keys Choice 3 The keys of an associative array in sorted order Choice 4 An associative array's contents in unsorted order Choice 5 An associative array's contents in reverse order Perl 5.12, Question 8 of 20

What would print the value stored in the last index of the @values array? Choice 1 print $values[-1]; Choice 2 print $#values; Choice 3 print $values[$#values - 1]; Choice 4 print $values[scalar @values]; Choice 5 print $#values[]; Perl 5.12, Question 9 of 20

What statement would open a file for writing, without clobbering the data already in it? Choice 1 open( my $fh, "w+", $filename ) or die $!; Choice 2 open( my $fh, ">>", $filename ) or die $!; Choice 3 open( my $fh, "+>", $filename ) or die $!; Choice 4 open( my $fh, ">+", $filename ) or die $!; Choice 5 open( my $fh, ">", $filename ) or die $!;

Perl 5.12, Question 10 of 20

Which regular expression deletes all tags specified as text, enclosed by "<" and ">", from a document stored in a string, but deletes nothing else. Choice 1 $string =~ s/<*&>//sg; Choice 2 $string =~ s/<.*>//sg; Choice 3 $string =~ s/<\S*>//sg; Choice 4 $string =~ s/<.*?>//sg; Choice 5 $string =~ s/<\s*>//sg; Perl 5.12, Question 11 of 20

Sample Code Based on the sample code above, what is another way of writing the code? Choice 1 if ($data == 5) print "Hello\n"; Choice 2 ($data == 5) || print "Hello\n"; Choice 3 print "Hello\n" || ($data == 5) ; Choice 4 print "Hello\n" if ($data == 5) ; Choice 5 print "Hello\n" unless ($data == 5) ; Perl 5.12, Question 12 of 20

How do you use telnet within Perl to connect and login? Choice 1 Choice 2 Choice 3

Choice 4 Choice 5 Perl 5.12, Question 13 of 20

Sample Code What does the above sample code produce? Choice 1 A list of all elements in the environment in sorted order Choice 2 A list of all elements in the environment in unsorted order Choice 3 A list of all elements in the environment in the order in which %ENV's keys were last accessed Choice 4 A stream of continuous output until the output is manually interrupted Choice 5 A syntax error Perl 5.12, Question 14 of 20

What expression is equivalent to pop(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1); Choice 5 splice(@data,0,0,1); Perl 5.12, Question 15 of 20

How are the values of an associative array placed in sorted order in a new array? Choice 1

my @newArray = sort values %hash; Choice 2 my @newArray = sort contents %hash; Choice 3 my @newArray = sort keys %hash; Choice 4 my @newArray = sort map {$_} %hash; Choice 5 my @newArray = values sort %hash; Perl 5.12, Question 16 of 20

Scenario You have a generalized routine that you want to distribute so it can be used in other code. Based on the scenario above, how do you distribute your code? Choice 1 Create a header file. Choice 2 Create a POD file. Choice 3 Create a library file. Choice 4 Create a Perl module. Choice 5 Create a object file. Perl 5.12, Question 17 of 20 What do you use to create a class? Choice 1 A package Choice 2 A hash Choice 3 A subroutine Choice 4 An anonymous hash Choice 5 A typeglob Perl 5.12, Question 18 of 20

How do you create a subroutine that accepts a scalar value?

Choice 1 sub routine($var) [ ]; Choice 2 sub routine (my $var) { } Choice 3 sub routine {my ($var)=@_;} Choice 4 my sub routine(local $var) { }; Choice 5 sub routine(*var) {}; Perl 5.12, Question 19 of 20

Sample Code

Based on the sample code above, what prints? Choice 1 1 Choice 2 10 Choice 3 13 Choice 4 23 Choice 5 120 Perl 5.12, Question 20 of 20

Which Perl feature helps to prevent data derived outside your program from affecting something else outside your program?

Choice 1 warnings Choice 2 taint checking Choice 3 nosuid Choice 4 exec Choice 5 system with qw(security) as an option Perl 5.12, Question 1 of 20

Sample Code

Based on the sample code above, what is the result of executing code? Choice 1 "Hello" is printed. Choice 2 "Hi" is printed. Choice 3 Nothing is printed. Choice 4 An error occurs because NewTest::new is not defined. Choice 5 An error occurs because NewTest::tprint is not defined. Perl 5.12, Question 2 of 20 How do you avoid problems with variables unintentionally having the same name in two parts of the same program? Choice 1 Variables should have their entire package name. Choice 2 Variables should be lexically scoped. Choice 3 Variables should consist of arrays and scalars only--avoiding hashes and other complex structures. Choice 4

Variables should be defined globally. Choice 5 Variables should be defined local to their context by specifying them as local. Perl 5.12, Question 3 of 20

Sample Code

Based on the sample code above, what text does the program print to standard output? Choice 1 @data Choice 2 101710 Choice 3 10 1 7 5 Choice 4 5175 Choice 5 10 1 7 10 Perl 5.12, Question 4 of 20

Sample Code Based on the sample code above, what must the sort block be in order to properly sort the numbers in descending, numerical order? Choice 1 {$b <=> $a} Choice 2 { ($1 < $2) ? 1 : (($1 > $2) : -1 : 0) }; Choice 3 {-($1 cmp $2)} Choice 4 {$a < $b} Choice 5 {$b cmp $a} Perl 5.12, Question 5 of 20

Sample Code

Based on the sample code above, what is another way of writing the code? Choice 1 if ($data == 5) print "Hello\n"; Choice 2 ($data == 5) || print "Hello\n"; Choice 3 print "Hello\n" || ($data == 5) ; Choice 4 print "Hello\n" if ($data == 5) ; Choice 5 print "Hello\n" unless ($data == 5) ; Perl 5.12, Question 6 of 20

Sample Code

Based on the sample code above, to which statement is the block equivalent? Choice 1 print split("\n",@arr) . "\n"; Choice 2 print join("\n",@arr) . "\n"; Choice 3 print map {"\n$_"} @arr; Choice 4 print "123\n"; Choice 5 print "1 2 3\n"; Perl 5.12, Question 7 of 20

How do you call a subroutine with a scalar value as an argument? Choice 1 $subname[$scalar]; Choice 2 $scalar=&subname; Choice 3 $scalar=&subname{}; Choice 4

subname{$scalar}; Choice 5 subname($scalar); Perl 5.12, Question 8 of 20

How do you create a subroutine that accepts a scalar value? Choice 1 sub routine($var) [ ]; Choice 2 sub routine (my $var) { } Choice 3 sub routine {my ($var)=@_;} Choice 4 my sub routine(local $var) { }; Choice 5 sub routine(*var) {}; Perl 5.12, Question 9 of 20

Sample Code @array = ('$var1', '$var2'); Choice 1 @array = qw($var1 $var2); Choice 2 @array = ("$var1", "$var2"); Choice 3 @array = ('\$var1', '\$var2'); Choice 4 @array = '$var1', '$var2'; Choice 5 @array = @{'$var1' '$var2'}; Perl 5.12, Question 10 of 20 What code is equivalent to the sample code above?

What expression is equivalent to pop(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1);

Choice 5 splice(@data,0,0,1); Perl 5.12, Question 11 of 20 What policy enforces declared variables, scoped variables, and some safe coding practices? Choice 1 Require all programming to exist within a defined subroutine, using only variables defined using "local". Choice 2 Require the "use safe" pragma in code. Choice 3 Avoid using modules. Choice 4 Require code that is clean with taint checking, warnings, and "use strict". Choice 5 Do not use the $_ variable; assign it to a named variable before using its data. Perl 5.12, Question 12 of 20

Sample Code $f = 4; for $f (1, 2, 3) { print $f; } print $f; Based on the sample code above, what is printed? Choice 1 123 Choice 2 4444 Choice 3 1233 Choice 4 1234 Choice 5 Nothing; the script exits with an error. Perl 5.12, Question 13 of 20

Sample Code

Based on the sample code above, in order to produce the total number of bytes used by all the items in the current directory, what replaces "????" ? Choice 1 map {my $size = -s $_; my $total += $size;} @files; Choice 2 map {my $size = -l $_; $total += $size;} @files; Choice 3 map {my $size = fsize $_; $total += $size;} @files; Choice 4 map {$total += -s $_;} @files; Choice 5 map {$total += fsize($_);} @files; Perl 5.12, Question 14 of 20 What would print the value stored in the last index of the @values array? Choice 1 print $values[-1]; Choice 2 print $#values; Choice 3 print $values[$#values - 1]; Choice 4 print $values[scalar @values]; Choice 5 print $#values[]; Perl 5.12, Question 15 of 20

Sample Code Based on the sample code above, what replaces ???? in order to convert all words in the input stream to begin with capital letters? Choice 1 tr/a-z/A-Z/;

Choice 2 tr/a-z/A-Z/b; Choice 3 s/[a-z]+/ucfirst($1)/gei; Choice 4 s/(\w+)/ucfirst($1)/gei; Choice 5 s/([a-z]+)/ucfirst($1)/gi; Perl 5.12, Question 16 of 20 What expression is equivalent to shift(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1); Choice 5 splice(@data,0,0,1); Perl 5.12, Question 17 of 20

Scenario You have a generalized routine that you want to distribute so it can be used in other code. Based on the scenario above, how do you distribute your code? Choice 1 Create a header file. Choice 2 Create a POD file. Choice 3 Create a library file. Choice 4 Create a Perl module. Choice 5 Create a object file. Perl 5.12, Question 18 of 20

Sample Code

Based on the sample code above, what is the output of the code? Choice 1 20 10 20 Choice 2 20 20 20 Choice 3 30 10 20 Choice 4 30 20 20 Choice 5 30 10 10 Perl 5.12, Question 19 of 20 How do you create an in-memory file? Choice 1 mmap(\$variable,1024); Choice 2 sysread($fh,\$variable,1024); Choice 3 $fh=sysread(\$variable); Choice 4 $scalar=open($fh,'>',undef) || die "Can't open"; Choice 5 open($fh,'>',\$variable) || die "Can't open" Perl 5.12, Question 20 of 20

What is one important difference between the "use" statement and the "require" statement?

Choice 1 Use statements can only be used to include modules; require statements cannot be used to include modules. Choice 2 Require statements can only be used to include modules; use statements cannot be used to include modules. Choice 3 Use statements are evaluated at run time; require statements are evaluated at compile time. Choice 4 Use statements are evaluated at compile time; require statements are evaluated at run time. Choice 5 Require statements can have an import list; use statements always import all the symbols exported by the module. Perl 5.12, Question 1 of 20

What do you use to create a class? Choice 1 A package Choice 2 A hash Choice 3 A subroutine Choice 4 An anonymous hash Choice 5 A typeglob Perl 5.12, Question 2 of 20 Which statement immediately exits a loop and continues execution with the first statement following the loop? Choice 1 exit Choice 2 next Choice 3 last Choice 4 goto Choice 5 die Perl 5.12, Question 3 of 20

Which items help in writing secure code? Choice 1 Enabling bounds checking, buffer overflow alerts, and lint checking Choice 2 Enabling profiling Choice 3 Enabling debugging Choice 4 Enabling the security module with "use Security;" Choice 5 Enabling taint checking, strict, and warnings Perl 5.12, Question 4 of 20

Sample Code

Based on the sample code above, what is the standard output? Choice 1 A list of all elements in the environment in sorted order Choice 2 A list of all elements in the environment in unsorted order Choice 3 A list of all elements in the environment in the order in which %ENV's keys were last accessed Choice 4 A stream of continuous output until the output is manually interrupted Choice 5 A syntax error is produced Perl 5.12, Question 5 of 20

What is returned when a call to system() executes successfully? Choice 1 -1 Choice 2 0 Choice 3 1 Choice 4

255 Choice 5 The pid of the subprocess. Perl 5.12, Question 6 of 20

Which regular expression deletes all tags specified as text, enclosed by "<" and ">", from a document stored in a string, but deletes nothing else. Choice 1 $string =~ s/<*&>//sg; Choice 2 $string =~ s/<.*>//sg; Choice 3 $string =~ s/<\S*>//sg; Choice 4 $string =~ s/<.*?>//sg; Choice 5 $string =~ s/<\s*>//sg; Perl 5.12, Question 7 of 20

Sample Code

Based on the sample code above, what is the output? Choice 1 1 Choice 2 135 Choice 3 357 Choice 4 11357 Choice 5 13571 Perl 5.12, Question 8 of 20

Sample Code

Based on the sample code above, what is the output of the code? Choice 1 20 10 20 Choice 2 20 20 20 Choice 3 30 10 20 Choice 4 30 20 20 Choice 5 30 10 10 Perl 5.12, Question 9 of 20 Which module is typically used to evaluate unknown or unsafe code within an optionally operator-restricted namespace? Choice 1 Opcode Choice 2 Taint Choice 3 Safe Choice 4 Overload Choice 5 Sigtrap Perl 5.12, Question 10 of 20

Sample Code

What does "$data" contain after the code is executed? Choice 1 The empty string Choice 2 The first byte in "file.dat" Choice 3 The first line in "file.dat" Choice 4 The first page in "file.dat" Choice 5 The entire file in "file.dat" Perl 5.12, Question 11 of 20 What expression is equivalent to pop(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1); Choice 5 splice(@data,0,0,1); Perl 5.12, Question 12 of 20 What expression is equivalent to shift(@data)? Choice 1 splice(@data,-1,1) Choice 2 splice(@data,0,1) Choice 3 splice(@data,1,1) Choice 4 splice(@data,-1,0,1); Choice 5 splice(@data,0,0,1); Perl 5.12, Question 13 of 20

Sample Code undef $/; Based on the code sample above, what is the effect during input or output? Choice 1 It reads the entire file. Choice 2 It specifies to Perl not to buffer file output. Choice 3 It displays a line at a time in output. Choice 4 It reads a line at a time. Choice 5 It makes later processing case insensitive. Perl 5.12, Question 14 of 20

What statement would assign to $n the number of elements in the hash %h? Choice 1 $n = scalar %h; Choice 2 $n = $#h; Choice 3 $n = count keys %h; Choice 4 $n = scalar keys %h; Choice 5 $n = count(%h); Perl 5.12, Question 15 of 20

Scenario You need to check to see what version of Perl a module you have written is running. You know that Perl versions earlier than 5.005 do not work properly with your module. Based on the scenario above, how do you check that the version of Perl is new enough? Choice 1 Using "$PERLVER>=5.005" Choice 2 Using "$|>=5.005" Choice 3 Using "$$>=5.005" Choice 4 Using "$]>=5.005" Choice 5

Using "%INC{VERSION}>=5.005" Perl 5.12, Question 16 of 20

Sample Code Based on the sample code above, what prints? Choice 1 11 12 13 Choice 2 1 2 3 Choice 3 1..1 1..2 1..3 Choice 4 1 12 123 Choice 5 1 21 321 Perl 5.12, Question 17 of 20

How do you call a subroutine with a scalar value as an argument? Choice 1 $subname[$scalar]; Choice 2 $scalar=&subname; Choice 3 $scalar=&subname{}; Choice 4 subname{$scalar}; Choice 5 subname($scalar); Perl 5.12, Question 18 of 20 Which conditional statement is equivalent to "if (!<condition>)"? Choice 1

ifn (<condition>) Choice 2 fails (<condition>) Choice 3 unless (<condition>) Choice 4 failure (<condition>) Choice 5 require (<condition>) Perl 5.12, Question 19 of 20

Sample Code

Based on the sample code above, in order to produce the total number of bytes used by all the items in the current directory, what replaces "????" ? Choice 1 map {my $size = -s $_; my $total += $size;} @files; Choice 2 map {my $size = -l $_; $total += $size;} @files; Choice 3 map {my $size = fsize $_; $total += $size;} @files; Choice 4 map {$total += -s $_;} @files; Choice 5 map {$total += fsize($_);} @files; Perl 5.12, Question 20 of 20

Das könnte Ihnen auch gefallen