Perl Online Quiz


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

Answer : C

Explanation

Hashes are unordered sets of key/value pairs that you access using the keys as subscripts. They are preceded by a percent sign (%).

Q 2 - Which of the following special variable represents current package name?

A - _PACKAGE_

B - Package

C - PACKAGE

D - None of the above.

Answer : A

Explanation

_PACKAGE_ -represents current package name.

Q 3 - Which of the following method sorts the LIST and returns the sorted array value?

A - splice [ SUBROUTINE ] LIST

B - split [ SUBROUTINE ] LIST

C - join [ SUBROUTINE ] LIST

D - sort [ SUBROUTINE ] LIST

Answer : D

Explanation

sort [ SUBROUTINE ] LIST − This function sorts the LIST and returns the sorted array value. If SUBROUTINE is specified then specified logic inside the SUBTROUTINE is applied while sorting the elements.

Answer : B

Explanation

To remove an element from the hash you need to use delete function.

Q 5 - Which of the following statement repeats a statement or group of statements until a given condition becomes true. It tests the condition before executing the loop body?

A - while

B - until

C - for

D - None of the above.

Answer : B

Explanation

until loop − Repeats a statement or group of statements until a given condition becomes true. It tests the condition before executing the loop body.

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 returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument?

A - eq

B - ne

C - cmp

D - ge

Answer : C

Explanation

cmp − Returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument.

Q 8 - Which of the following operator derefereces a variable?

A - --

B - ->

C - ..

D - ++

Answer : B

Explanation

-> − The arrow operator is mostly used in dereferencing a method or variable from an object or a class name.

perl_questions_answers.htm
Advertisements