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 1 - Which of the following data types are preceded by an "at" sign (@) in Perl?

A - Scalar

B - Array

C - Hashes

D - All of the above.

Answer : B

Explanation

Arrays are preceded by an "at" sign (@).

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

A - FILE

B - _FILE_

C - file

D - None of the above.

Answer : B

Explanation

_FILE_ -represents current file 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.

Q 4 - Which of the following statement restarts the loop block without evaluating the conditional again?

A - next

B - last

C - continue

D - redo

Answer : D

Explanation

redo statement − The redo command restarts the loop block without evaluating the conditional again. The continue block, if any, is not executed.

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 checks if the value of left operand is less than the value of right operand, if yes then condition becomes true?

A - <

B - >=

C - <=

D - <=>

Answer : A

Explanation

> − Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.

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

A - eq

B - ne

C - cmp

D - ge

Answer : B

Explanation

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

Answer : A

Explanation

Lexical variables are private variables created using my operator.

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