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 a dollar sign ($) in Perl?

A - Scalar

B - Array

C - Hashes

D - All of the above.

Answer : A

Explanation

Scalars are preceded by a dollar sign ($).

Q 2 - Which of the following variable context only happens inside quotes, or things that work like quotes?

A - Interpolative

B - List

C - Boolean

D - Void.

Answer : A

Explanation

Interpolative − This context only happens inside quotes, or things that work like quotes.

Q 3 - Which of the following method pushes the values of the list onto the end of the array?

A - push @ARRAY, LIST

B - pop @ARRAY

C - shift @ARRAY

D - unshift @ARRAY, LIST

Answer : A

Explanation

push @ARRAY, LIST − Pushes the values of the list onto the end of the array.

Q 4 - Which of the following statement restarts the loop block without evaluating the conditional again?

A - next

B - last

C - continue

D - redo

Answer : D

Explanation

redo statement − The redo command restarts the loop block without evaluating the conditional again. The continue block, if any, is not executed.

Q 5 - Which of the following operator checks if the value of two operands are equal or not, if values are not equal then condition becomes true?

A - ==

B - !=

C - <=>

D - >

Answer : B

Explanation

!= − Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.

Q 6 - Which of the following operator returns true if the left argument is stringwise equal to the right argument?

A - eq

B - ne

C - cmp

D - ge

Answer : A

Explanation

eq − Returns true if the left argument is stringwise equal to the right argument.

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 formats date and time?

A - localtime

B - gmtime

C - time

D - strftime

Answer : D

Explanation

strftime − formats date and time.

Q 10 - Which of the following function renames existing file?

A - rename

B - tell

C - seek

D - None of the above.

Answer : A

Explanation

Function rename takes two arguments and it just rename existing file.

perl_questions_answers.htm
Advertisements