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, an expression is being evaluated to see whether it's true or false?

A - Scalar

B - List

C - Boolean

D - Void.

Answer : C

Explanation

Boolean − Boolean context is simply any place where an expression is being evaluated to see whether it's true or false.

Q 3 - Which of the following method pops off and returns the last value of the array?

A - push @ARRAY, LIST

B - pop @ARRAY

C - shift @ARRAY

D - unshift @ARRAY, LIST

Answer : B

Explanation

pop @ARRAY - Pops off and returns the last value of the array.

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 statement expects the expression to return a label name and then jumps to that labeled statement?

A - goto LABEL

B - goto EXPR

C - goto &NAME

D - None of the above.

Answer : B

Explanation

goto EXPR − The goto EXPR form is just a generalization of goto LABEL. It expects the expression to return a label name and then jumps to that labeled statement.

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

A - eq

B - ne

C - cmp

D - ge

Answer : A

Explanation

eq − Returns true if the left argument is stringwise equal to the right argument.

Q 7 - Which of the following operator returns a list of values counting (up by ones) from the left value to the right value?

A - .

B - x

C - ..

D - ++

Answer : C

Explanation

.. − The range operator .. returns a list of values counting (up by ones) from the left value to the right value.

Q 8 - Parameters of a function can be acessed inside the function using the special array @_?

A - true

B - false

Answer : A

Explanation

Parameters can be acessed inside the function using the special array @_. Thus the first argument to the function is in $_[0], the second is in $_[1], and so on.

Q 9 - Which of the following operator is used when the current value of a variable must be visible to called subroutines?

A - my

B - local

C - state

D - None of the above.

Answer : B

Explanation

The local is used when the current value of a variable must be visible to called subroutines.

perl_questions_answers.htm
Advertisements