Perl Mock Test


Advertisements

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.

Questions and Answers

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

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?

A - ==

B - !=

C - <=>

D - >

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?

A - <

B - >=

C - <=

D - <=>

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?

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 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 - <=>

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?

A - lt

B - gt

C - le

D - ge

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?

A - lt

B - gt

C - le

D - ge

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?

A - lt

B - gt

C - le

D - ge

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?

A - lt

B - gt

C - le

D - ge

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?

A - eq

B - ne

C - cmp

D - ge

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?

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

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?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

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?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

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?

A - q{ }

B - qq{ }

C - qx{ }

D - enclose{}

Answer : C

Explanation

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

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

A - .

B - x

C - ..

D - ++

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?

A - .

B - x

C - ..

D - ++

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?

A - .

B - x

C - ..

D - ++

Answer : C

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 - ++

Answer : 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 - ++

Answer : A

Explanation

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

Q 21 - 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 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

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

A - localtime

B - gmtime

C - time

D - strftime

Answer : B

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

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?

A - localtime

B - gmtime

C - time

D - strftime

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
perl_questions_answers.htm
Advertisements