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 - Is perl a case sensitive language?

A - true

B - false

Answer : A

Explanation

Perl is a case sensitive programming language. Thus $Manpower and $manpower are two different identifiers in Perl.

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 : A

Explanation

You can get the size − that is, the number of elements from a hash by using the scalar context on either keys or values.

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 or equal to the right argument?

A - lt

B - gt

C - le

D - ge

Answer : D

Explanation

ge − Returns true if the left argument is stringwise greater than or equal to the right argument.

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 the current local time on the machine that runs the script?

A - localtime

B - gmtime

C - time

D - strftime

Answer : A

Explanation

localtime − returns the current local time on the machine that runs the script.

Q 9 - Which of the following function opens a file in writing mode without truncating the file?

A - open(DATA, "<file.txt");

B - open(DATA, ">file.txt");

C - open(DATA, "+<file.txt");

D - None of the above.

Answer : C

Explanation

open(DATA, "+<file.txt"); − opens a file in writing mode without truncating the file.

Q 10 - Which of the following function disassociate the filehandle from the corresponding file?

A - close

B - unlink

C - seek

D - None of the above.

Answer : A

Explanation

close − To close a filehandle, and therefore disassociate the filehandle from the corresponding file, you use the close function. This flushes the filehandle's buffers and closes the system's file descriptor.

perl_questions_answers.htm
Advertisements