- 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 Mock Test
This section presents you various set of Mock Tests related to Perl. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Perl Mock Test III
Q 1 - Which of the following operator checks if the value of two operands are equal or not, and returns -1, 0, or 1?
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 2 - 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 3 - Which of the following operator checks if the value of left operand is less than the value of right operand, if yes then condition becomes true?
Answer : A
Explanation
> − Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
Q 4 - 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?
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 5 - Which of the following operator checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true?
Answer : C
Explanation
<= − Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
Q 6 - Which of the following operator returns true if the left argument is stringwise less than the right argument?
Answer : A
Explanation
lt − Returns true if the left argument is stringwise less than the right argument.
Q 7 - 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.
Q 8 - Which of the following operator returns true if the left argument is stringwise less than or equal to the right argument?
Answer : C
Explanation
le − Returns true if the left argument is stringwise less than or equal to the right argument.
Q 9 - Which of the following operator returns true if the left argument is stringwise greater than or equal to the right argument?
Answer : D
Explanation
ge − Returns true if the left argument is stringwise greater than or equal to the right argument.
Q 10 - Which of the following operator returns true if the left argument is stringwise equal to the right argument?
Answer : A
Explanation
eq − Returns true if the left argument is stringwise equal to the right argument.
Q 11 - Which of the following operator returns true if the left argument is stringwise not equal to the right argument?
Answer : B
Explanation
ne − Returns true if the left argument is stringwise not equal to the right argument.
Q 12 - Which of the following operator returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument?
Answer : C
Explanation
cmp − Returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument.
Q 13 - Which of the following operator encloses a string with-in single quotes?
Answer : A
Explanation
q{ } − Encloses a string with-in single quotes.
Q 14 - Which of the following operator encloses a string with-in double quotes?
Answer : B
Explanation
qq{ } − Encloses a string with-in double quotes.
Q 15 - Which of the following operator encloses a string with-in invert quotes?
Answer : C
Explanation
qx{ } − Encloses a string with-in invert quotes.
Answer : A
Explanation
. − Binary operator dot (.) concatenates two strings.
Q 17 - Which of the following operator returns a string consisting of the left operand repeated the number of times specified by the right operand?
Answer : B
Explanation
x − The repetition operator x returns a string consisting of the left operand repeated the number of times specified by the right operand.
Q 18 - Which of the following operator returns a list of values counting (up by ones) from the left value to the right value?
Answer : C
Explanation
.. − The range operator .. returns a list of values counting (up by ones) from the left value to the right value.
Answer : D
Explanation
++ − Auto Increment operator increases integer value by one.
Answer : A
Explanation
-- − Auto Decrement operator decreases integer value by one.
Answer : B
Explanation
-> − The arrow operator is mostly used in dereferencing a method or variable from an object or a class name.
Q 22 - 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 23 - Which of the following function returns the universal Greenwich Mean Time, or GMT (or UTC)?
Answer : B
Explanation
gmtime − returns the universal Greenwich Mean Time, or GMT (or UTC).
Q 24 - 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 25 - Which of the following function formats date and time?
Answer : D
Explanation
strftime − formats date and time.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | C |
2 | D |
3 | A |
4 | B |
5 | C |
6 | A |
7 | B |
8 | C |
9 | D |
10 | A |
11 | B |
12 | C |
13 | A |
14 | B |
15 | C |
16 | A |
17 | B |
18 | C |
19 | D |
20 | A |
21 | B |
22 | A |
23 | B |
24 | C |
25 | D |