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 1 - Which of the following data types are preceded by an "at" sign (@) in Perl?

A - Scalar

B - Array

C - Hashes

D - All of the above.

Answer : B

Explanation

Arrays are preceded by an "at" sign (@).

Q 2 - In which of the following variable context, an expression is being evaluated to see whether it's true or false?

A - Scalar

B - List

C - Boolean

D - Void.

Answer : C

Explanation

Boolean − Boolean context is simply any place where an expression is being evaluated to see whether it's true or false.

Answer : B

Explanation

To remove an element from the hash you need to use delete function.

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 returns true if the left argument is stringwise greater than the right argument?

A - lt

B - gt

C - le

D - ge

Answer : B

Explanation

gt − Returns true if the left argument is stringwise greater than the right argument.

Q 7 - Which of the following operator returns a list of values counting (up by ones) from the left value to the right value?

A - .

B - x

C - ..

D - ++

Answer : C

Explanation

.. − The range operator .. returns a list of values counting (up by ones) from the left value to the right value.

Q 8 - Parameters of a function can be acessed inside the function using the special array @_?

A - true

B - false

Answer : A

Explanation

Parameters can be acessed inside the function using the special array @_. Thus the first argument to the function is in $_[0], the second is in $_[1], and so on.

Q 10 - Which of the following function returns a single character from the specified FILEHANDLE, or STDIN if none is specified?

A - close

B - getc

C - seek

D - None of the above.

Answer : B

Explanation

The getc function returns a single character from the specified FILEHANDLE, or STDIN if none is specified.

perl_questions_answers.htm
Advertisements