Q. STDIN in Perl stands for ___.

  • (A) Standard input output stream
  • (B) STandarD INput
  • (C) Solo input
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) STandarD INput
Explanation: STDIN in Perl stands for STandarD INput.

Q. Which of these is a decision-making statement in Perl?

  • (A) if
  • (B) unless
  • (C) if-else ladder
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these
Explanation: Decision making statement in Perl are:

If
Else-if
Else-elsif
Unless
Unless-if
Unless-elsif

Q. The code blocks unless the statement is executed when the condition is ___.

  • (A) True
  • (B) False
  • (C) ---
  • (D) ----
πŸ’¬ Discuss
βœ… Correct Answer: (B) False
Explanation: The code blocks unless the statement is executed when the condition is False.

Q. Unless_elsif statement contains ___.

  • (A) elsif statement along with unless
  • (B) if nested inside unless
  • (C) unless nested inside elsif
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) elsif statement along with unless
Explanation: unless elsif statement has elseif statement working with unless.

Q. Valid loops in Perl are ___.

  • (A) for
  • (B) foreach
  • (C) do while
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these
Explanation: Valid loops in Perl are for, foreach, while, do while, until, nested loop.

Q. foreach loop can iterate over __.

  • (A) List
  • (B) Integer
  • (C) Class
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) List
Explanation: Foreach loop can iterate over a list.

Q. While in Perl is entry controlled?

  • (A) Yes
  • (B) No
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) Yes
Explanation: While loop in Perl is entry controlled.

Q. Until loop in Perl is ___.

  • (A) Opposite of while loop.
  • (B) Used to execute code when condition is false
  • (C) Entry controlled loop
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these
Explanation: Until loop in Perl is an entry-controlled loop with acts just opposite to while loop i.e., the code inside the loop will run if the condition inside it is false.

Q. What will be the output of the following Perl code?

Code:
$a = 8;

until ($a <= 7){
    print "Value of a = $a\n";
    $a = $a - 1;
}
  • (A) Value of a = 8
  • (B) Infinite loop
  • (C) No run
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (A) Value of a = 8

Q. What is a given-when statement in Perl?

  • (A) loop
  • (B) Multiway branch statement
  • (C) function
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) Multiway branch statement
Explanation: Given-when in Perl is a multiway branch statement.