www go4expert com articles multiple choice questions perl t21042

Upload: deepak-thapa

Post on 02-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    1/8

    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 1my $statement = $dbh->execute("INSERT INTO names VALUES ('John')");

    Choice 2

    my $statement = $dbh->sql("INSERT INTO names VALUES ('John')");

    $statement->execute;

    Go4Expert> Articles> Programming> Perl> Multiple Choice Questions in PERL

    Multiple Choice Questions in PERL

    Contributed by ungalnanbanOn 19th February, 2010

    This is an article on Multiple Choice Questions in PERLin Perl.

    http://www.go4expert.com/dmca/http://www.go4expert.com/siteindex.phphttp://www.go4expert.com/faq.phphttp://www.go4expert.com/newsletter/http://www.go4expert.com/search.php?do=getnewhttp://www.go4expert.com/search.phphttp://www.go4expert.com/community/job-offers/http://www.go4expert.com/community/job-offers/http://www.go4expert.com/community/http://www.go4expert.com/articles/http://www.go4expert.com/http://www.go4expert.com/http://www.go4expert.com/http://www.go4expert.com/http://localhost/var/www/apps/conversion/tmp/scratch_9/#http://www.go4expert.com/dmca/http://www.go4expert.com/siteindex.phphttp://www.go4expert.com/faq.phphttp://www.go4expert.com/newsletter/http://www.go4expert.com/search.php?do=getnewhttp://www.go4expert.com/search.phphttp://www.go4expert.com/community/job-offers/http://www.go4expert.com/community/http://www.go4expert.com/forums/http://www.go4expert.com/articles/http://www.go4expert.com/http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=69164http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/programming/http://www.go4expert.com/articles/http://www.go4expert.com/
  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    2/8

    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 "" from a

    document stored in a string, but deletes nothing else.

    Choice 1

    $string =~ s///g;Choice 2

    $string =~ s///g;

    Choice 3

    $string =~ 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:

  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    3/8

    @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

  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    4/8

    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 1In 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 (!)"?

    Choice 1

    unless ()

    Choice 2

  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    5/8

    failure ()

    Choice 3

    fails ()

    Choice 4

    ifn ()

    Choice 5

    require ()

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    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"

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    shabbir

    Go4Expert Founder

    #2

    rahuliet2008

    Newbie Member

    #3

    0

    0

    mishrabhishek4like this

    Related Articles

    100 Multiple choice questions in C, by coderzonein C

    HTML Beginners question, by coderzonein Web Design, HTML And CSS Tutorials

    2Mar2010,20:35

    Nomination for Article of the month - Feb 2010started. Nominate this article.

    22Nov2010,14:36

    https://plus.google.com/share?url=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/https://www.facebook.com/sharer/sharer.php?u=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/https://twitter.com/share?related=go4expert&via=go4expert&text=Multiple%20Choice%20Questions%20in%20PERL&url=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=82850http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=82850http://www.go4expert.com/showthread.php?t=21173https://plus.google.com/share?url=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/https://www.facebook.com/sharer/sharer.php?u=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/https://twitter.com/share?related=go4expert&via=go4expert&text=Multiple%20Choice%20Questions%20in%20PERL&url=http://www.go4expert.com/articles/multiple-choice-questions-perl-t21042/http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=1http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=1http://www.go4expert.com/articles/html-beginners-question-t677/http://www.go4expert.com/articles/100-multiple-choice-questions-c-t1373/http://localhost/var/www/apps/conversion/tmp/scratch_9/member.php?s=c9e1f09885fc8fb5b0ae177630f0db37&u=114521
  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    6/8

    fr where i get the answ

    Article Tools

    Already a member?

    User Name: User Name Save

    Password Log in

    Forgot Username/Password?

    Not a member yet?

    Create Your Free Account Now.

    Search Go4Expert

    Search

    Advance Search

    Latest Forum Topics

    Perl login problem

    Under Perl

    Perl post process action

    Under Perl

    Rate this Article Printable Version

    http://www.go4expert.com/forums/perl/http://www.go4expert.com/forums/perl-post-process-action-t29654/http://www.go4expert.com/forums/perl/http://www.go4expert.com/forums/perl-login-problem-t29961/http://www.go4expert.com/search.phphttp://localhost/var/www/apps/conversion/tmp/scratch_9/register.phphttp://localhost/var/www/apps/conversion/tmp/scratch_9/login.php?do=lostpwhttp://localhost/var/www/apps/conversion/tmp/scratch_9/printthread.php?s=c9e1f09885fc8fb5b0ae177630f0db37&t=21042http://localhost/var/www/apps/conversion/tmp/scratch_9/#
  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    7/8

    Compile Error in Perl

    Under Perl

    Need help with a script for a project

    Under Perl

    perl script to get url from file

    Under Perl

    Find Us On Facebook

    Latest Articles

    Clean User Input HTML using HTML::Scrubber

    Under Perl

    Introduction to JSON in Perl

    Under Perl

    Simple Web Crawler in Perl

    Under Perl

    Twitter Controlled RAT (Mobile accessible)

    Under Perl

    Multiple Choice Questions in PERL

    Under Perl

    http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/twitter-controlled-rat-mobile-accessible-t22241/http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/simple-web-crawler-perl-t23088/http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/introduction-json-perl-t27215/http://www.go4expert.com/articles/perl-tutorials/http://www.go4expert.com/articles/clean-user-input-html-using-htmlscrubber-t28443/http://www.facebook.com/go4experthttp://www.go4expert.com/forums/perl/http://www.go4expert.com/forums/perl-script-url-file-t28408/http://www.go4expert.com/forums/perl/http://www.go4expert.com/forums/help-script-project-t28681/http://www.go4expert.com/forums/perl/http://www.go4expert.com/forums/compile-error-perl-t29612/
  • 8/11/2019 Www Go4expert Com Articles Multiple Choice Questions Perl t21042

    8/8

    Contact Us- Go4Expert.com - Programming and Web Development Forum- Sitemap- Forum- Privacy Statement

    - Top

    User Contribution Licensed Under Creative Commons with Attribution Required. Site Design and Logo Copyright

    Go4Expert 2004 - 2014.

    http://creativecommons.org/licenses/by-sa/3.0/deed.en_UShttp://localhost/var/www/apps/conversion/tmp/scratch_9/#tophttp://www.go4expert.com/privacy.phphttp://localhost/var/www/apps/conversion/tmp/scratch_9/forumshttp://www.go4expert.com/sitemap/http://www.go4expert.com/http://localhost/var/www/apps/conversion/tmp/scratch_9/sendmessage.php?s=c9e1f09885fc8fb5b0ae177630f0db37