- Perl Basics
- Perl - Home
- Perl - Introduction
- Perl - Environment
- Perl - Syntax Overview
- Perl - Data Types
- Perl - Variables
- Perl - Scalars
- Perl - Arrays
- Perl - Hashes
- Perl - IF...ELSE
- Perl - Loops
- Perl - Operators
- Perl - Date & Time
- Perl - Subroutines
- Perl - References
- Perl - Formats
- Perl - File I/O
- Perl - Directories
- Perl - Error Handling
- Perl - Special Variables
- Perl - Coding Standard
- Perl - Regular Expressions
- Perl - Sending Email
- Perl Advanced
- Perl - Socket Programming
- Perl - Object Oriented
- Perl - Database Access
- Perl - CGI Programming
- Perl - Packages & Modules
- Perl - Process Management
- Perl - Embedded Documentation
- Perl - Functions References
- Perl Useful Resources
- Perl - Questions and Answers
- Perl - Quick Guide
- Perl - Useful Resources
- Perl - Discussion
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 correctly describes Array data types in Perl?
A - These are simple variables. They are preceded by a dollar sign ($).
B - These are ordered lists of scalars that you access with a numeric index which starts with 0.
C - These are unordered sets of key/value pairs that you access using the keys as subscripts.
Answer : B
Explanation
Arrays are ordered lists of scalars that you access with a numeric index which starts with 0. They are preceded by an "at" sign (@).
Q 2 - In which of the following variable context, an expression is being evaluated to see whether it's true or false?
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 shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down?
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 - How will you delete a key/value pair to a hash?
Answer : B
Explanation
To remove an element from the hash you need to use delete function.
Q 5 - Which of the following statement repeats a statement or group of statements until a given condition becomes true. It tests the condition before executing the loop body?
Answer : B
Explanation
until loop − Repeats a statement or group of statements until a given condition becomes true. It tests the condition before executing the loop body.
Q 6 - Which of the following operator returns true if the left argument is stringwise greater than the right argument?
Answer : B
Explanation
gt − Returns true if the left argument is stringwise greater than the right argument.
Answer : D
Explanation
++ − Auto Increment operator increases integer value by one.
Q 8 - Which of the following function returns epoch time?
Answer : C
Explanation
time − returns epoch time, i.e. the numbers of seconds that have elapsed since a given date, in Unix is January 1, 1970.
Q 9 - Which of the following is true about Perl references?
B - Because of its scalar nature, a reference can be used anywhere, a scalar can be used.
Answer : C
Explanation
Both of the above options are correct.
Q 10 - Which of the following code create a reference for a subroutine?
Answer : D
Explanation
You can create a reference for any subroutine by prefixing it with a backslash as follows - $ref = \&PrintHash;
To Continue Learning Please Login
Login with Google