Olete.in
Articles
Mock Tests
๐งช Perl MCQ Quiz Hub
Perl Mcq Question Set 1
Choose a topic to test your knowledge and improve your Perl skills
1. Which function is used by perl for reversing a string?
rev
reverse
split
substr
2. Scalar stores
Multiple value
Single value
Double value
Float value
3. When you're pattern matching, you describe the pattern using
A string in double quotes
A MySQL select statement
A regular expression
A template
4. When the "require" function loads?
Runtime
Compile time
Both
none of the above
5. Which of the following statement repeats a statement or group of statements until a given condition becomes true. It tests the condition before executing the loop body?
while
until
for
none of the above
6. Select comparison operator from the options.
*=
&&
!=
=
7. What will be printed by the code below? my $val = {}; print ref($val);
empty value
Array
Hash
Scalar
8. It is often more convenient to save perl program files with ____ extension
.gp
.sh
.awk
.pl
9. Which of the following is used in perl?
else if
elseif
elsif
elif
10. Language which features rich text processing capabilities and flexibility is
Perl
C
Visual Basic
Ada
11. When a string is used for numeral computations, perl converts it into
character
floating point number
number
boolean value
12. Scalar is denoted by_______in Perl.
#
$
%
^
13. In Perl, the words function and subroutines are used interchangeably.
True
False
All the above
none of the above
14. How do you perform a forward declaration of a subroutine performed?
forward sub name
sub name
forward name
sub name {}
15. What will display the list of warning messages regarding the code?
Strict pragma
The -w Command-line argument
Using the built-in debugger
none of the above
16. Which of these is NOT available for Perl
Perl, legally, for free
Individual and site licenses
Full documentation of the language which you can print out yourself
A Caribbean cruise in 2006 on which you can meet some of the Perl gurus
17. The "+=ย is which type of operator?
comparison operators
Arithmetic operators
Increment/ decrements operators
Assignment operators
18. The getdir command
Reads a single file name from an open directory handle
Reads the rest of the file names from an open directory handle
Only works after anopendir command
Is not a perl command
19. Select the option which allows the user to scroll through the entire program line by line in Perl.
Using the strict pragma
Using the built-in debugger
Using the string pragma
Using the built-in error
20. What will be the value in the variable $a after these two statements: $a = "Happy"; $a = "Sunday";?
"Happy Sunday"
"HappySunday"
"Happy"
"Sunday"
21. Which function is used by perl for displaying the length of a string?
string
len
split
length
22. When you create a variable, you may assume it starts off containing
1
You may not make any assumption
The boolean value "false"
A null string (or 0 arithmetically)
23. Command line arguments in Perl are stored in
Scalar
Resource
Array
Hash
24. Which one of the following is the most powerful filter?
awk
grep
sed
perl
25. A perl program runs in a special interpretive mode.
True
False
all of the above
none of the above
26. To test whether perl is in your PATH, use ____
perl -e
perl -i
perl -el
perl -ed
27. It is often more convenient to save perl program files with ____ extension.
.gp
.sh
.awk
.pl
28. ___ function is used for removing the last character from the line.
cut
chop
erase
split
29. perl variables have no type and no initialization.
True
False
all of the above
none of the above
30. When a string is used for numeral computations, perl converts it into ___
character
floating point number
number
boolean value
31. If a variable is undefined, its value is ____
0
1
NULL
garbage
32. Which of the following are concatenation operators?
/
.
_
\
33. To repeat a string, perl uses ___ operator.
/
.
x
\
34. ___ function returns the first occurrence of a character in a string.
string
index
split
length
35. For extracting a substring, ____ function is used.
string
index
substr
length
36. substr function is also used to alter an existing string.
True
False
all of the above
asStub()
37. Which function is used for handling substitutions in perl?
tr
s
str
tr and s
38. Which escape character is used for identifying a word character?
s
d
w
39. We can use find command for testing files with perl.
True
False
all of the above
none of the above
40. We can specify filenames in command line using perl.
True
False
all of the above
none of the above
41. Which of the following is referred to as default variable?
$0
$1
$!
$_
42. ___ operator is used for selecting current line number.
$0
$1
$.
$_
43. ___ is known as range operator.
. .
$1
$.
$_
44. The command @x=(1. .10) will assign first ten integer values to the array โaโ.
True
False
all of the above
none of the above
45. The ___ prefix to an array name signifies the last index of the array.
$0
$#
#$
$_
46. For deleting the elements from the left of the array ___ function is used.
pop
push
queue
shift
47. For deleting the elements from the right of the array ___ function is used.
pop
push
queue
shift
48. To add elements to the left side of the array ____ function is used.
pop
push
queue
unshift
49. To add elements to the right side of the array ____ function is used.
pop
push
queue
unshift
50. Which function can combine the functionalities of push, pop, unshift and shift?
splice
add
delete
split
Submit