Perl Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Perl. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 2 - In which of the following variable context, assignment to a scalar variable evaluates the right-hand side in a scalar context?

A - Scalar

B - List

C - Boolean

D - Void.

Answer : A

Explanation

Scalar − Assignment to a scalar variable evaluates the right-hand side in a scalar context.

Q 3 - Which of the following method shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down?

A - push @ARRAY, LIST

B - pop @ARRAY

C - shift @ARRAY

D - unshift @ARRAY, LIST

Answer : C

Explanation

shift @ARRAY − Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down.

Q 4 - Which of the following statement causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating?

A - next

B - last

C - continue

D - redo

Answer : A

Explanation

next statement − Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

Q 5 - Which of the following operator performs exponential (power) calculation on operators?

A - *

B - /

C - %

D - **

Answer : D

Explanation

** − Exponent − Performs exponential (power) calculation on operators.

Q 6 - Which of the following operator returns true if the left argument is stringwise less than the right argument?

A - lt

B - gt

C - le

D - ge

Answer : A

Explanation

lt − Returns true if the left argument is stringwise less than the right argument.

Q 7 - Which of the following operator encloses a string with-in invert quotes?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

Answer : C

Explanation

qx{ } − Encloses a string with-in invert quotes.

Q 8 - Which of the following function formats date and time?

A - localtime

B - gmtime

C - time

D - strftime

Answer : D

Explanation

strftime − formats date and time.

Q 10 - Which of the following code create a reference for a subroutine?

A - $ref = \$foo;

B - $ref = \@ARGV;

C - $ref = \%ENV;

D - $ref = \&PrintHash;

Answer : D

Explanation

You can create a reference for any subroutine by prefixing it with a backslash as follows - $ref = \&PrintHash;

perl_questions_answers.htm
Advertisements