R4RIN
Articles
Java 8
MCQS
Perl MCQ Quiz Hub
Perl Mcq Question Set 3
Choose a topic to test your knowledge and improve your Perl skills
1. Which is the basic data type of Perl?
Integer
Scalars
Vectors
Typeglob
2. How are scalars marked with?
#
!
$
%
3. Which among the following are Scalars supported by Perl?
number,boolean, character
integer, boolean and character
number, character and reference
number, string and reference
4. Which operator is used to compare Strings in Perl?
'Computer'.equal('Computer')
'Computer' eq 'Computer'
'Computer' equals 'Computer'
'Computer' == 'Computer'
5. Which mong the following statements are/is true? S1: Attempting to use string operations on numbers will raise warnings S2: Attempting to use number operations on non-numeric strings will raise warnings
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
6. Array References in Perl are _______
Scalars
Vectors
Typed
none of the above
7. Which is true with respect to Array References in Perl?
Array References can be nested
Array Reference's contents can be accessed using dot(.)
Array References refer to Arrays,Numbers and Stirngs
When used as Boolean, references are not always true.
8. Which operator is used to access the contents of Array References?
dot (.)
->
=>
$
9. Scalar Reference is used in which scenarios? S1: Disambiguate a file name from file content S2: Disambiguate returned content from a returned error string
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
10. Which among the choices are/is false with respect to Arrays in Perl?
Arrays are mutable
Arrays store an ordered sequence of values
looping over the contents of an array is possible
Arrays are mutable and immutable
11. Which of the following is not a sigil in Perl?
*typeglob
&function('arguments');
$#array;
@array = ( 1, 2, 3, 4, 5 );
12. Chhose the correct Statements: S1: Typeglobs are handled when dealing with files S2: Typeglob *foo holds references to the contents of global variables
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
13. Under which scenario & sigil is not used in Perl?
To make a reference to subroutine
To call a function by ignoring its prototype
Can be combined with goto()
To accept an expression
14. Which of the following acepts an expression in Perl?
@{}
@()
$()
${}
15. Which of the statements are false with respect to Hash References in perl? S1: Hash references are scalars S2: Any changes made within the subroutine will be made to the original hash
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
16. In Perl, if the keys in Hash are not strings-then
Throws compile time error
get converted to strings
automatic conversion to strings is not handled
treated as barewords
17. How to access an element of %hash?
$hash{key}
%hash{key}
@hash{key}
#hash{key}
18. Which among the following helps to create hashes out of arrays?
array and list flattening
map and list flattening
array and map flattening
map and tuple flattening
19. When does hashes becomes true if used as boolean?
When they are empty
When they are barewords
When they are converted to map
When they not empty
20. Which among the following esacpe sequence is not interpolated by Perl?
v
21. Which among the following statements are true? S1: Double quotes interpolate the enclosed string S2: Single quotes interpolate the enclosed string
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
22. Which of the following number evaluates to true in Perl?
say 0 ? 'true' : 'false';
say -1 ? 'true' : 'false';
say 1-1 ? 'true' : 'false';
say -0.00 ? 'true' : 'false'; # false
23. Which of the following Strings evaluates to false in Perl?
say 'a' ? 'true' : 'false';
say 'false' ? 'true' : 'false';
say ' ' ? 'true' : 'false';
say '0.0' ? 'true' : 'false';
24. use Time::Piece; is available in which version of Perl?
Perl 2
Perl 3
Perl 4
Perl 5
25. How to create a new datetime?
$dt = DateTime->now( time_zone => 'Asia');
$dt = DateTime::now( time_zone => 'Asia');
$dt = now::DateTime->( time_zone => 'Asia');
$dt = DateTime=>now( time_zone -> 'Asia');
26. Which of the following conditional statements not supported by Perl?
unless
ternary
if-else
until
27. Which keyword is used to create Subroutines in Perl?
sub
subroutine
mod
fn
28. When functions are to be treated as variables which sigil is mandatory?
$
&
#
%
29. What does the function does not output when use Data::Show; is used in Perl?
name of the variable
contents of that variable
address of that variable
the file from where show is run from
30. Which is false with respect to array and list relationship?
Array contains a list
A list can be assigned to an array
ordered sequence of zero or more scalars
none of the above
31. Which of the following usage of List is not allowed in Perl?
Assigning a list to a hash
Passing list to subroutines
Returning list from subroutine
Stack operation
32. Choose the correct choice with respect to Perl S1: List can be assigned to hash s2: Hash can be used as list
S1 only
S2 only
Both S1 and S2
Neither S1 nor S2
33. Which operator is used in comparator function to compare strings?
==
compare
<=>
cmp
34. Which operator is used in comparator function to compare numbers?
<=>
cmp
compare
==
35. Which of the following is not true with respect to Sorting in Perl? (Version > 5.16)
There is only one function sort used by Perl for sorting
Sorts nested datastructure
Does case senstive sort
Reverse Sort can be done
36. What does the mode '>' write (trunc) does in Perl?
Will not overwrite existing files
Creates a new file if no file was found
Append new content at the end of it
Opens the file in read only mode
37. What does the '+>' file operation denote in Perl?
Read / Write
Read / Write (trunc)
Read / Write (append)
Write (append)
38. What does the '+>>' file operation denote in Perl?
Read / Write
Read / Write (trunc)
Read / Write (append)
Write (append)
39. Which among the following enables faster file read?
File::Slurper
File::Dumper
File::Compress
Path::Tiny
Submit