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 interpolates variables and special characters in Perl?

A - Single Quotes based String

B - Double Quotes based String

C - Both of the above.

D - None of the above.

Answer : B

Explanation

Only double quotes interpolate variables and special characters such as newlines , where as single quote does not interpolate any variable or special character.

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.

Answer : B

Explanation

split [ PATTERN [ , EXPR [ , LIMIT ] ] ] - This function splits a string into an array of strings, and returns it. If LIMIT is specified, splits into at most that number of fields. If PATTERN is omitted, splits on whitespace.

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 jumps to the statement labeled with LABEL and resumes execution from there?

A - goto LABEL

B - goto EXPR

C - goto &NAME

D - None of the above.

Answer : A

Explanation

goto LABEL − The goto LABEL form jumps to the statement labeled with LABEL and resumes execution from there.

Q 6 - Which of the following operator checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true?

A - ==

B - !=

C - <=>

D - >

Answer : D

Explanation

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

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