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 4 - Which of the following function returns all keys of a Hash?

A - keys

B - values

C - Both of the above.

D - None of the above.

Answer : A

Explanation

keys − You can get a list of all of the keys from a hash by using keys function.

Q 5 - Which of the following operator divides left hand operand by right hand operand and returns remainder?

A - *

B - /

C - %

D - **

Answer : C

Explanation

% − Modulus − Divides left hand operand by right hand operand and returns remainder.

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 concatenates two strings?

A - .

B - x

C - ..

D - ++

Answer : A

Explanation

. − Binary operator dot (.) concatenates two strings.

Q 8 - Which of the following function returns the universal Greenwich Mean Time, or GMT (or UTC)?

A - localtime

B - gmtime

C - time

D - strftime

Answer : B

Explanation

gmtime − returns the universal Greenwich Mean Time, or GMT (or UTC).

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

A - $ref = \$foo;

B - $ref = \@ARGV;

C - $ref = \%ENV;

D - $ref = \&PrintHash;

Answer : A

Explanation

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

perl_questions_answers.htm
Advertisements