See the following questions. It will improve your PERL knowledge. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 1 How do you perform a forward declaration of a subroutine performed? Choice 1 forward sub name; Choice 2 sub name; Choice 3 forward name; Choice 4 sub name {}; Choice 5 sub {}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 2 Sample Code Code: INSERT INTO names VALUES ('John') How do you use the DBI module to execute the above SQL statement? Assume $dbh is the return value from DBI->connect. Choice 1 my $statement = $dbh->execute("INSERT INTO names VALUES ('John')"); Choice 2 my $statement = $dbh->sql("INSERT INTO names VALUES ('John')"); $statement->execute; Choice 3 my $statement = $dbh->prepare("INSERT INTO names VALUES ('John')"); $statement->execute; Choice 4 my $statement = $dbh->run("INSERT INTO names VALUES ('John')"); Choice 5 my $statement = $dbh->insert("INSERT INTO names VALUES ('John')"); $statement->finish; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 3 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/<*&>//g; Choice 2 $string =~ s/<\S*>//g; Choice 3 $string =~ s/<\s*>//g; Choice 4 $string =~ s/<.*?>//g; Choice 5 $string =~ s/<.*>//g; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 4 Which one of the following completely defines scalars? Choice 1 A number, an array, or a associative array Choice 2 A single string, number, or reference Choice 3 A string, a lexical array, or a numeric value Choice 4 A pointer, a stack, or a heap Choice 5 An int, float, double, or char - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 5 Sample Code Code: @values = ( "value1", "value2", ("value3", "value4") ); How does Perl store the nested list shown above? Choice 1 The list is stored as a hierarchical list. Choice 2 The list is stored as a hash with the offsets as keys to the hash. Choice 3 The list is flattened by removing all internal bracketing. Choice 4 The list stores two values, "value1" and "value2", plus a pointer to the internal list. Choice 5 The list stores two values, "value1" and "value2", plus two pointers to "value3" and "value4." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 6 Sample Code Code: printSorted(\@list,dir => 'asc', type => 'numerical'); Many functions in perl take option lists such as the ones in the above code sample. Given the information shown 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,$option1,$option2) = @_; Choice 4 my ($data,$options) = @_; Choice 5 my (@data,@options) = @_; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 7 Which one of the following regexes matches between 1 to 4 ab's followed by a tab and an integer number? Choice 1 (ab)+{4}\t\d* Choice 2 ab[ababab]\t[0-9] Choice 3 {ab,4}\t\d+ Choice 4 (ab)?[1-4]\t[0-9]* Choice 5 (ab){1,4}\t\d+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 8 Sample Code Code 1: Code: my @lines = grep /^hi/, @allLines; Code 2: Code: my @lines = (); foreach (@allLines) { push (@lines,$_) if (/^hi/); } What is the difference between the two snippets (Code 1 and Code 2) above? Choice 1 In code 1, the operation occurs in one command; code 2 iterates each element in the array for matches. Choice 2 In code 1, the elements of @lines are the indexes in @allLines, in which matches were found. Choice 3 In code 1, the elements of "@lines" begin with the index in "@allLines", in which the match was found. Choice 4 In code 2, no matches are found. Choice 5 In code 1, "@lines" may not necessarily be in the same order; the original lines appear in "@allLines". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 9 Which conditional statement is equivalent to "if (!<condition>)"? Choice 1 unless (<condition>) Choice 2 failure (<condition>) Choice 3 fails (<condition>) Choice 4 ifn (<condition>) Choice 5 require (<condition>) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 10 Problem 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. Given the problem shown above, how do you check that the version of Perl is new enough? Choice 1 Using "$|>=5.005" Choice 2 Using "$]>=5.005" Choice 3 Using "%INC{VERSION}>=5.005" Choice 4 Using "$PERLVER>=5.005" Choice 5 Using "$$>=5.005" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -