Perl/Perl Mcq Question Set 3 Sample Test,Sample questions

Question:
Array References in Perl are _______

1.Scalars

2.Vectors

3.Typed

4.none of the above


Question:
Chhose the correct Statements: S1: Typeglobs are handled when dealing with files S2: Typeglob *foo holds references to the contents of global variables

1.S1 only

2.S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
Choose the correct choice with respect to Perl S1: List can be assigned to hash s2: Hash can be used as list

1.S1 only

2. S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
How are scalars marked with?

1.#

2.!

3.$

4.%


Question:
How to access an element of %hash?

1.$hash{key}

2.%hash{key}

3.@hash{key}

4.#hash{key}


Question:
How to create a new datetime?

1.$dt = DateTime->now( time_zone => 'Asia');

2.$dt = DateTime::now( time_zone => 'Asia');

3.$dt = now::DateTime->( time_zone => 'Asia');

4.$dt = DateTime=>now( time_zone -> 'Asia');


Question:
In Perl, if the keys in Hash are not strings-then

1.Throws compile time error

2.get converted to strings

3.automatic conversion to strings is not handled

4.treated as barewords


Question:
Scalar Reference is used in which scenarios? S1: Disambiguate a file name from file content S2: Disambiguate returned content from a returned error string

1.S1 only

2.S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
Under which scenario & sigil is not used in Perl?

1.To make a reference to subroutine

2.To call a function by ignoring its prototype

3.Can be combined with goto()

4.To accept an expression


Question:
use Time::Piece; is available in which version of Perl?

1.Perl 2

2.Perl 3

3. Perl 4

4.Perl 5


Question:
What does the '+>' file operation denote in Perl?

1.Read / Write

2.Read / Write (trunc)

3.Read / Write (append)

4.Write (append)


Question:
What does the '+>>' file operation denote in Perl?

1.Read / Write

2.Read / Write (trunc)

3.Read / Write (append)

4.Write (append)


Question:
What does the function does not output when use Data::Show; is used in Perl?

1.name of the variable

2.contents of that variable

3.address of that variable

4. the file from where show is run from


Question:
What does the mode '>' write (trunc) does in Perl?

1.Will not overwrite existing files

2.Creates a new file if no file was found

3.Append new content at the end of it

4.Opens the file in read only mode


Question:
When does hashes becomes true if used as boolean?

1.When they are empty

2.When they are barewords

3.When they are converted to map

4.When they not empty


Question:
When functions are to be treated as variables which sigil is mandatory?

1.$

2.&

3.#

4.%


Question:
Which among the choices are/is false with respect to Arrays in Perl?

1.Arrays are mutable

2.Arrays store an ordered sequence of values

3.looping over the contents of an array is possible

4.Arrays are mutable and immutable


Question:
Which among the following are Scalars supported by Perl?

1.number,boolean, character

2.integer, boolean and character

3.number, character and reference

4.number, string and reference


Question:
Which among the following enables faster file read?

1.File::Slurper

2. File::Dumper

3.File::Compress

4.Path::Tiny


Question:
Which among the following esacpe sequence is not interpolated by Perl?

1.

2.

3.

4.v


Question:
Which among the following helps to create hashes out of arrays?

1.array and list flattening

2.map and list flattening

3.array and map flattening

4.map and tuple flattening


Question:
Which among the following statements are true? S1: Double quotes interpolate the enclosed string S2: Single quotes interpolate the enclosed string

1.S1 only

2.S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
Which is false with respect to array and list relationship?

1. Array contains a list

2.A list can be assigned to an array

3.ordered sequence of zero or more scalars

4.none of the above


Question:
Which is the basic data type of Perl?

1.Integer

2.Scalars

3.Vectors

4.Typeglob


Question:
Which is true with respect to Array References in Perl?

1.Array References can be nested

2.Array Reference's contents can be accessed using dot(.)

3.Array References refer to Arrays,Numbers and Stirngs

4.When used as Boolean, references are not always true.


Question:
Which keyword is used to create Subroutines in Perl?

1.sub

2.subroutine

3.mod

4.fn


Question:
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

1. S1 only

2.S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
Which of the following acepts an expression in Perl?

1.@{}

2.@()

3.$()

4.${}


Question:
Which of the following conditional statements not supported by Perl?

1.unless

2.ternary

3.if-else

4.until


Question:
Which of the following is not a sigil in Perl?

1.*typeglob

2.&function('arguments');

3.$#array;

4.@array = ( 1, 2, 3, 4, 5 );


Question:
Which of the following is not true with respect to Sorting in Perl? (Version > 5.16)

1.There is only one function sort used by Perl for sorting

2.Sorts nested datastructure

3.Does case senstive sort

4.Reverse Sort can be done


Question:
Which of the following number evaluates to true in Perl?

1.say 0 ? 'true' : 'false';

2.say -1 ? 'true' : 'false';

3.say 1-1 ? 'true' : 'false';

4.say -0.00 ? 'true' : 'false'; # false


Question:
Which of the following Strings evaluates to false in Perl?

1.say 'a' ? 'true' : 'false';

2.say 'false' ? 'true' : 'false';

3.say ' ' ? 'true' : 'false';

4.say '0.0' ? 'true' : 'false';


Question:
Which of the following usage of List is not allowed in Perl?

1.Assigning a list to a hash

2.Passing list to subroutines

3.Returning list from subroutine

4.Stack operation


Question:
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

1.S1 only

2.S2 only

3.Both S1 and S2

4.Neither S1 nor S2


Question:
Which operator is used in comparator function to compare numbers?

1.<=>

2.cmp

3.compare

4.==


Question:
Which operator is used in comparator function to compare strings?

1.==

2.compare

3.<=>

4.cmp


Question:
Which operator is used to access the contents of Array References?

1. dot (.)

2.->

3.=>

4.$


Question:
Which operator is used to compare Strings in Perl?

1.'Computer'.equal('Computer')

2.'Computer' eq 'Computer'

3.'Computer' equals 'Computer'

4.'Computer' == 'Computer'


More MCQS

  1. Perl Mcq Question Set 1
  2. Perl Mcq Question Set 2
  3. Perl Mcq Questions Set 4
  4. Perl Mcq Question Set 3
  5. PERL Multiple Choice Questions Set 1
  6. PERL Multiple Choice Questions Set 2
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!