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.
Q 1 - Which of the following data types are preceded by an "at" sign (@) in Perl?
Answer : B
Explanation
Arrays are preceded by an "at" sign (@).
Q 2 - Which of the following special variable represents current file name?
Answer : B
Explanation
_FILE_ -represents current file name.
Q 3 - Which of the following is correct about Hashes?
A - A hash is a set of key/value pairs.
Answer : D
Explanation
All of the above options are correct.
Q 4 - Which of the following statement terminates the loop statement and transfers execution to the statement immediately following the loop?
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 statement jumps to the statement labeled with LABEL and resumes execution from there?
Answer : A
Explanation
goto LABEL − The goto LABEL form jumps to the statement labeled with LABEL and resumes execution from there.
Q 6 - Which of the following operator checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true?
Answer : D
Explanation
> − Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
Q 7 - Which of the following operator encloses a string with-in double quotes?
Answer : B
Explanation
qq{ } − Encloses a string with-in double quotes.
Q 8 - Which of the following function returns the current local time on the machine that runs the script?
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 read-only mode?
Answer : A
Explanation
open(DATA, "<file.txt"); − opens a file in read-only mode.
Q 10 - Which of the following code create a reference for a variable?
Answer : A
Explanation
You can create a reference for any variable by prefixing it with a backslash as follows - $ref = \$foo;