# 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?

A - ==

B - !=

C - <=>

D - >

### 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?

A - ==

B - !=

C - <=>

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?

A - <

B - >=

C - <=

D - <=>

### 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?

A - <

B - >=

C - <=

D - <=>

### 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?

A - <

B - >=

C - <=

D - <=>

### 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?

A - lt

B - gt

C - le

D - ge

### 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?

A - lt

B - gt

C - le

D - ge

### 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?

A - lt

B - gt

C - le

D - ge

### 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?

A - lt

B - gt

C - le

D - ge

### 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?

A - eq

B - ne

C - cmp

D - ge

### 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?

A - eq

B - ne

C - cmp

D - ge

### 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?

A - eq

B - ne

C - cmp

D - ge

### 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?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

### Explanation

q{ } − Encloses a string with-in single quotes.

Q 14 - Which of the following operator encloses a string with-in double quotes?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

### Explanation

qq{ } − Encloses a string with-in double quotes.

Q 15 - Which of the following operator encloses a string with-in invert quotes?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

### Explanation

qx{ } − Encloses a string with-in invert quotes.

Q 16 - Which of the following operator concatenates two strings?

A - .

B - x

C - ..

D - ++

### 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?

A - .

B - x

C - ..

D - ++

### 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?

A - .

B - x

C - ..

D - ++

### Explanation

.. − The range operator .. returns a list of values counting (up by ones) from the left value to the right value.

Q 19 - Which of the following operator increases integer value by one?

A - .

B - x

C - ..

D - ++

### Explanation

++ − Auto Increment operator increases integer value by one.

Q 20 - Which of the following operator decreases integer value by one?

A - --

B - ->

C - ..

D - ++

### Explanation

-- − Auto Decrement operator decreases integer value by one.

Q 21 - Which of the following operator derefereces a variable?

A - --

B - ->

C - ..

D - ++

### 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?

A - localtime

B - gmtime

C - time

D - strftime

### 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)?

A - localtime

B - gmtime

C - time

D - strftime

### Explanation

gmtime − returns the universal Greenwich Mean Time, or GMT (or UTC).

Q 24 - Which of the following function returns epoch time?

A - localtime

B - gmtime

C - time

D - strftime

### 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?

A - localtime

B - gmtime

C - time

D - strftime

### Explanation

strftime − formats date and time.

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