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

Q 2 - Which of the following special variable represents current line number?

A - LINE

B - Line

C - _LINE_

D - None of the above.

Answer : C

Explanation

_LINE_ -represents current line number.

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 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 checks if the value of two operands are equal or not, and returns -1, 0, or 1?

A - ==

B - !=

C - <=>

D - >

Answer : C

Explanation

<=> − Checks if the value of two operands are equal or not, and returns -1, 0, or 1 depending on whether the left argument is numerically less than, equal to, or greater than the right argument.

Q 7 - Which of the following operator returns a string consisting of the left operand repeated the number of times specified by the right operand?

A - .

B - x

C - ..

D - ++

Answer : B

Explanation

x − The repetition operator x returns a string consisting of the left operand repeated the number of times specified by the right operand.

Answer : C

Explanation

The my operator confines a variable to a particular region of code in which it can be used and accessed. Outside that region, this variable cannot be used or accessed.

Q 10 - Which of the following function returns current position of a pointer in a file?

A - rename

B - tell

C - seek

D - None of the above.

Answer : B

Explanation

You can use tell function to know the current position of a file.

perl_questions_answers.htm
Advertisements