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.

Answer : A

Explanation

Adding a new key/value pair can be done with one line of code using simple assignment operator.

Q 5 - Which of the following statement executes a sequence of statements multiple times and abbreviates the code that manages the loop variable?

A - while

B - until

C - for

D - None of the above.

Answer : C

Explanation

for loop − Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.

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 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.

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 9 - Which of the following function deletes a file?

A - delete

B - unlink

C - seek

D - None of the above.

Answer : B

Explanation

unlink − used to delete a file.

perl_questions_answers.htm
Advertisements