03rd
Mar
Perl MCQ

Perl MCQ

  • Admin
  • 03rd Mar, 2021
  • 825 Followers

Perl MCQ Questions

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

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

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

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

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

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

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

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

  • A. split
  • B. string
  • C. length
  • D. len
Download Free : Perl MCQ PDF

6) Which of the following is used in perl?

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

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

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

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

  • A. reverse
  • B. rev
  • C. substr
  • D. split

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

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

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

11) 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/) .....

12) 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 ] ]

13) 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.

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

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

15) When the “require” function loads?

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

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

17) "+=" known as following operator:

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

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

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

19) "%" is used with:

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

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

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

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

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

24) To repeat a string, perl uses ___ operator

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

25) Perl was first released in:

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

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

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

28) 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!"]

29) It is possible to create objects in Perl?

  • A. Yes
  • B. No

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

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

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

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

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

01st
Dec
Laravel MCQ
01st
Dec
React JS MCQ
01st
Jan
AngularJs MCQ
01st
Jul
Node js MCQ
01st
Jul
Angular 2 MCQ
01st
Jul
JSON MCQ