Q. Can a given-when statement be nested in Perl?

  • (A) Yes
  • (B) No
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (A) Yes
Explanation: Perl allows the programmer to nest given-when statements too.

Q. Is the goto statement in Perl used to ___.

  • (A) Iterate over statements
  • (B) Jump from anywhere to anywhere within the block
  • (C) Create an entry point in program
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) Jump from anywhere to anywhere within the block
Explanation: The goto statement in Perl is used to jump from anywhere to anywhere with the block of code.

Q. Is the Redo operator in Perl used?

  • (A) Create a loop
  • (B) Jump the flow to the given label skipping the current block execution
  • (C) Repeat current block evaluation
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) Jump the flow to the given label skipping the current block execution
Explanation: The redo operator is used to Jump the flow to the given label skipping the current block execution.

Q. Which keyword is used to make the current iteration last one?

  • (A) end
  • (B) exit
  • (C) last
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) last
Explanation: The last keyword in Perl can make the current iteration of the loop the last one.

Q. Which of these is a data type in Perl?

  • (A) Scalars
  • (B) Array
  • (C) Hashes
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these
Explanation: Data types in Perl are:

Scalar
Array
Hashes

Q. Which of these is a type of the scalar in Perl?

  • (A) Array
  • (B) String
  • (C) Hash
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) String
Explanation: Scalar variables in Perl are a single unit of data. Different types of scalars in Perl are string, character, floating point, large group of string, webpage, etc.

Q. The % sign in Perl is used to ___.

  • (A) Declare a hash
  • (B) Accessing a hash value
  • (C) Initialize a loop
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (A) Declare a hash
Explanation: Hash in Perl are declared using the % sign.

Q. The elements of the array are ___.

  • (A) Number
  • (B) String
  • (C) Characters
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of these
Explanation: The elements of the array can be number, string, characters, etc.

Q. Array in Perl created using?

  • (A) %
  • (B) @
  • (C) $
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (B) @
Explanation: Array declaration in Perl is done using @.

Q. Which is a valid way to extract the size of an array in Perl?

  • (A) _len(@array_name)
  • (B) @array_name.length()
  • (C) $size = scalar @array_name
  • (D) All of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) $size = scalar @array_name
Explanation: The valid way to extract the size of an array in Perl is:

$size = scalar @array_name