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 data type is suppported in Perl?

A - Scalar

B - Array

C - Hashes

D - All of the above.

Answer : D

Explanation

All of the above data types are supported in Perl.

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 shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down?

A - push @ARRAY, LIST

B - pop @ARRAY

C - shift @ARRAY

D - unshift @ARRAY, LIST

Answer : C

Explanation

shift @ARRAY − Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down.

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 yes then condition becomes true?

A - ==

B - !=

C - <=>

D - >

Answer : A

Explanation

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

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

A - lt

B - gt

C - le

D - ge

Answer : A

Explanation

lt − Returns true if the left argument is stringwise less than 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.

Answer : A

Explanation

Lexical variables are private variables created using my operator.

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