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 - 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.

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 terminates the loop statement and transfers execution to the statement immediately following the loop?

A - next

B - last

C - continue

D - redo

Answer : B

Explanation

last statement − Terminates the loop statement and transfers execution to the statement immediately following the loop.

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 two operands are equal or not, and returns -1, 0, or 1?

A - ==

B - !=

C - <=>

D - >

Answer : C

Explanation

<=> − Checks if the value of two operands are equal or not, and returns -1, 0, or 1 depending on whether the left argument is numerically less than, equal to, or greater than the right argument.

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

A - eq

B - ne

C - cmp

D - ge

Answer : B

Explanation

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

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 9 - Which of the following function opens a file in read-only mode?

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

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

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

D - None of the above.

Answer : A

Explanation

open(DATA, "<file.txt"); − opens a file in read-only mode.

Q 10 - Which of the following function points current position of a pointer to a particular position in a file?

A - rename

B - tell

C - seek

D - None of the above.

Answer : C

Explanation

You can use seek function to point a particular position inside the file.


perl_questions_answers.htm

Advertisements