17th
Apr
Perl MCQ

Perl MCQ

  • Admin
  • 17th Apr, 2021
  • 622 Followers

Perl MCQ Questions

Following are mostly asked Perl MCQ test that are designed for professionals like you to crack you interviews. You can take this Perl online test before appearing to you real interview. This Perl quiz there are around 30+ multiple choice questions on Perl with four options.

1) To test whether perl is in your PATH, use....

  • A. perl -i
  • B. perl -ed
  • C. perl -e
  • D. perl -el

2) Which one of the following is the most powerful filter?

  • A. sed
  • B. perl
  • C. awk
  • D. grep

3) Which escape character is used for identifying a word character?

  • A. \n
  • B. \s
  • C. \d
  • D. \w

4) Which function is used for handling substitutions in perl?

  • A. tr and s
  • B. s
  • C. tr
  • D. str

5) Which function is used by perl for reversing a string?

  • A. reverse
  • B. rev
  • C. substr
  • D. split
Download Free : Perl MCQ PDF

6) For extracting a substring, ____ function is used.

  • A. length
  • B. index
  • C. substr
  • D. string

7) To repeat a string, perl uses ___ operator

  • A. x
  • B. //
  • C. /
  • D. .

8) In which of the following variable context, assignment to a scalar variable evaluates the right-hand side in a scalar context?

  • A. Boolean
  • B. Void
  • C. Scalar
  • D. List

9) Which of the following method remove the elements of @ARRAY designated by OFFSET and LENGTH, and replaces them with LIST, if specified?

  • A. split @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]
  • B. sort @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]
  • C. join @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]
  • D. splice @ARRAY, OFFSET [ , LENGTH [ , LIST ] ]

10) When you're pattern matching, you describe the pattern using:

  • A. template
  • B. A MySQL select statement
  • C. A string in double quotes
  • D. A regular expression

11) How will you add a new key/value pair to a hash?

  • A. using assign operator
  • B. Using simple assignment
  • C. Both of the above.
  • D. none

12) When the “require” function loads?

  • A. Compile time
  • B. Runtime
  • C. Both A and B
  • D. none

13) Select the option which allows the user to scroll through the entire program line by line in Perl:

  • A. Using the built-in debugger
  • B. Using the built-in error
  • C. Using the string pragma
  • D. Using the strict pragma

14) Which function is used by perl for displaying the length of a string?

  • A. split
  • B. string
  • C. length
  • D. len

15) How do you perform a forward declaration of a subroutine performed?

  • A. forward name
  • B. forward sub name
  • C. sub name {}
  • D. sub name

16) Which of the following expression matches a line which begins with a?

  • A. /$a/
  • B. /@a/
  • C. /~a/
  • D. /^a/

17) Perl code to push variable 'x' to array 'arr' is:

  • A. push $x @arr
  • B. push @arr $x
  • C. push @arr, $x
  • D. push @arr ($x)

18) Perl code to exit the program with error message 'Error detected !' is?

  • A. die "Error detected!"
  • B. exit; "Error detected!"
  • C. die $"Error detected!"
  • D. die["Error detected!"]

19) It is possible to create objects in Perl?

  • A. Yes
  • B. No

20) The statement open (FH,"abc.txt");

  • A. contains an error, so won't compile
  • B. opens the file abc.txt for appending
  • C. opens the file abc.txt for reading
  • D. opens the file abc.txt for overwriting

21) Which brackets do you use to change the order of precedence of operations?

  • A. Round brackets
  • B. Curly braces
  • C. You don't use brackets in Perl - you write in RPN (Reverse Polish Notation)
  • D. Square brackets

22) Which of the following tests if the string held in $qn includes the word "perl"?

  • A. if ($qn eq "perl") .....
  • B. if ($qn == "perl") ....
  • C. if ($qn = "perl") .....
  • D. if ($qn =~ /perl/) .....

23) Perl was first released in:

  • A. 1987
  • B. 1988
  • C. 1989
  • D. 1990

24) What is Perl?

  • A. Practice for Exclusive and Report Language
  • B. Practical Exclusive and Report Language
  • C. Practical Extraction and Report Language
  • D. Practical Extraction and Report Learning

25) Which of the following is used in perl?

  • A. elif
  • B. elsif
  • C. else if
  • D. elseif

26) The getdir command:

  • A. Only works after anopendir command
  • B. Reads a single file name from an open directory handle
  • C. Reads the rest of the file names from an open directory handle
  • D. Is not a perl command.

27) The value of the expression $yards += 10:

  • A. relies on which command line arguments were used
  • B. cannot be determined from the information given
  • C. is 10
  • D. is true

28) "%" is used with:

  • A. Arrays
  • B. Scalar Variables
  • C. Subroutines
  • D. Has Variables

29) Which one of the following is comparison operator in Perl?

  • A. &&
  • B. ||
  • C. !=
  • D. =

30) "+=" known as following operator:

  • A. Comparision Operator
  • B. Assignment Operator
  • C. Arithematic Operator
  • D. Increment/Decrement Operator

31) Which of the following symbol is used to denote Arrays?

  • A. #
  • B. %
  • C. @
  • D. $

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
May
PHP MCQ
01st
May
Python MCQ
01st
May
Spring MCQ
01st
May
NLP MCQ
01st
Apr
Corel Draw MCQ