πŸ“Š Perl
Q. Is boolean type provided in Perl?
  • (A) Yes
  • (B) No
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (B) No

Explanation: There is no boolean type in Perl.

πŸ“Š Perl
Q. What will be the output of the following Perl code?
Code:
$m = 2;

if ($m){
    print "True";
}
else{
    print "False";
}
  • (A) True
  • (B) False
  • (C) Error
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) True
πŸ“Š Perl
Q. Which of these is the 'True' value in Perl?
  • (A) ""
  • (B) 0
  • (C) 5
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) 5

Explanation: All value greater than 0 are true in Perl.

πŸ“Š Perl
Q. Which of the following is a type of operator in Perl?
  • (A) Arithmetic Operator
  • (B) Relational Operator
  • (C) Ternary Operator
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these

Explanation: Types of operators:

Arithmetic Operator
Relation Operator
Logical Operator
Bitwise Operator
Assignment Operator
Ternary Operator

πŸ“Š Perl
Q. Logical operators in Perl are ___.
  • (A) Used to compare values
  • (B) Used to combine conditions
  • (C) Used to perform arithmetic operations
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) Used to combine conditions

Explanation: Logical operators in Perl are used to combine multiple conditions.

πŸ“Š Perl
Q. The result of the following operation is
Code:
100 << 3
  • (A) 001
  • (B) 300
  • (C) 800
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 800

Explanation: The "<<" is a binary left shift operator, if left shifts the bits of the first operand, the second operand decides the number of places to shift.

πŸ“Š Perl
Q. Which of the following is a valid assignment operator in Perl?
  • (A) =
  • (B) ==
  • (C) +=
  • (D) %=
πŸ’¬ Discuss
βœ… Correct Answer: (B) ==

Explanation:
= is simple assignment operator
+= is addition assignment operator
%= is remainder assignment operator

πŸ“Š Perl
Q. What will be the output of the following Perl code?
Code:
$val1 = 5;
$val2 = 10;

$result = $val1 == $val2 ? $val1 : $val2;

print "$result"
  • (A) 5
  • (B) 15
  • (C) 10
  • (D) 20
πŸ’¬ Discuss
βœ… Correct Answer: (C) 10
πŸ“Š Perl
Q. 'x' operator on string used to?
  • (A) Add x character to the string
  • (B) Repeat the given string multiple times
  • (C) Add two strings
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) Repeat the given string multiple times

Explanation: The "x" operator in Perl strings is used to repeat the given string multiple times.

πŸ“Š Perl
Q. Is auto increment/ decrement operator valid in Perl?
  • (A) Yes
  • (B) No
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) Yes

Explanation: In Perl, auto increment / decrement operator are used to increase or decrease values.