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 2 - Which of the following special variable represents current file name?

A - FILE

B - _FILE_

C - file

D - None of the above.

Answer : B

Explanation

_FILE_ -represents current file name.

Q 3 - Which of the following method pops off and returns the last value of the array?

A - push @ARRAY, LIST

B - pop @ARRAY

C - shift @ARRAY

D - unshift @ARRAY, LIST

Answer : B

Explanation

pop @ARRAY - Pops off and returns the last value of the array.

Q 4 - Which of the following function returns all keys of a Hash?

A - keys

B - values

C - Both of the above.

D - None of the above.

Answer : A

Explanation

keys − You can get a list of all of the keys from a hash by using keys function.

Q 5 - Which of the following statement substitutes a call to the named subroutine for the currently running subroutine?

A - goto LABEL

B - goto EXPR

C - goto &NAME

D - None of the above.

Answer : C

Explanation

goto &NAME − It substitutes a call to the named subroutine for the currently running subroutine.

Q 6 - Which of the following operator checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true?

A - <

B - >=

C - <=

D - <=>

Answer : B

Explanation

>= − Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.

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 operator derefereces a variable?

A - --

B - ->

C - ..

D - ++

Answer : B

Explanation

-> − The arrow operator is mostly used in dereferencing a method or variable from an object or a class name.

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

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

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

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

D - None of the above.

Answer : B

Explanation

open(DATA, ">file.txt"); − opens a file in writing mode after truncating the file.

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