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 line number?

A - LINE

B - Line

C - _LINE_

D - None of the above.

Answer : C

Explanation

_LINE_ -represents current line number.

Q 3 - Which of the following method joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns the string?

A - splice EXPR, LIST

B - split EXPR, LIST

C - join EXPR, LIST

D - sort EXPR, LIST

Answer : C

Explanation

join EXPR, LIST − This function joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns the string.

Q 4 - Which of the following statement terminates the loop statement and transfers execution to the start of the loop?

A - next

B - last

C - continue

D - redo

Answer : C

Explanation

continue statement − A continue BLOCK, it is always executed just before the conditional is about to be evaluated again.

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 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 increases integer value by one?

A - .

B - x

C - ..

D - ++

Answer : D

Explanation

++ − Auto Increment operator increases integer value by one.

Q 8 - Which of the following function returns epoch time?

A - localtime

B - gmtime

C - time

D - strftime

Answer : C

Explanation

time − returns epoch time, i.e. the numbers of seconds that have elapsed since a given date, in Unix is January 1, 1970.

Q 10 - Which of the following code create a reference for a array?

A - $ref = \$foo;

B - $ref = \@ARGV;

C - $ref = \%ENV;

D - $ref = \&PrintHash;

Answer : B

Explanation

You can create a reference for any array by prefixing it with a backslash as follows - $ref = \@ARGV;


perl_questions_answers.htm

Advertisements