Mason (Perl)/Perl Programming MCQs Set 2 Sample Test,Sample questions

Question:
 Keys of the hash are extracted using?

1.Index

2.Using key function

3.Converting to array

4.None of These


Question:
 Length of string in Perl is calculated using ___.

1.len()

2.length()

3.size()

4.All of the these


Question:
 List context of the returned value from a subroutine is extracted using ___.

1.#

2.$

3.@

4.None of These


Question:
 The code blocks unless the statement is executed when the condition is ___.

1.True

2.False

3.Error

4.None of these


Question:
 Which module is required to perform excel operation in Perl?

1.Excel::creator

2.Sheets::manager

3.Excel::Writer::XLSX

4.None of These


Question:
 Which of the following methods is used to display expressions in Perl?

1.cout()

2.say()

3.println()

4.None of the above


Question:
A built-in subroutine which is used inside the method is?

1.Mutable parameter

2.Trait

3.Method

4.All of these


Question:
Array in Perl created using?

1.%

2. @

3.$

4.None of these


Question:
Automatic end of line is added using which statement?

1.print()

2.clear()

3.say()

4.None of these


Question:
Can a given-when statement be nested in Perl?

1.Yes

2.No

3.Error

4.None of these


Question:
foreach loop can iterate over __.

1.List

2.Integer

3.Class

4.None of These


Question:
Immutable parameters in Perl are?

1.Special immutable string parameters passed to the function

2.Values that cannot be modified within the function

3. Values that can be modified within the function

4.None of these


Question:
Is it possible to pass file handles to subroutines in Perl?

1.Yes

2.No

3.Error

4.None of these


Question:
Is the goto statement in Perl used to ___.

1.Iterate over statements

2.Jump from anywhere to anywhere within the block

3.Create an entry point in program

4.None of these


Question:
Is the Redo operator in Perl used?

1.Create a loop

2.Jump the flow to the given label skipping the current block execution

3.Repeat current block evaluation

4.All of the above


Question:
Is the Scalar keyword in Perl is used to?

1.Create a scalar value

2.Convert expression to scalar context

3.Perform forceful evaluation to scalar

4.All of the these


Question:
Operations of Perl hashes are ___.

1.Accessing value

2.Updating value

3.Iteration

4.All of these


Question:
STDIN in Perl stands for ___.

1.Standard input output stream

2.STandarD INput

3.Solo input

4.None of these


Question:
The $ in Perl is used to create ___.

1.Hash

2.Array

3.Scalar

4.All of the these


Question:
The % sign in Perl is used to ___.

1.Declare a hash

2.Accessing a hash value

3.Initialize a loop

4.All of the above


Question:
The '==' operation is not valid on string in Perl?

1.True

2.False

3.Error

4.None of These


Question:
The 'It' operator of string is used to ___.

1.Concatenate string

2.Check if the string to its left is stringwise less than string to its left

3.Substitute text

4.None of these


Question:
The elements of the array are ___.

1.Number

2.String

3.Characters

4.All of the these


Question:
The print method in Perl return ___.

1.boolean value

2.string

3.char

4.None of These


Question:
The return() function in Perl is ___.

1.a subroutine from return package

2.return value at the end of subroutines

3.return named subroutine

4.None of these


Question:
Unless_elsif statement contains ___.

1.elsif statement along with unless

2.if nested inside unless

3.unless nested inside elsif

4.None of these


Question:
Until loop in Perl is ___.

1.Opposite of while loop.

2.Used to execute code when condition is false

3.Entry controlled loop

4.All of the these


Question:
Valid loops in Perl are ___.

1.for

2.foreach

3.do while

4.All of the mentioned


Question:
What are reference in Perl?

1.A way to access data with another variable

2.Referring a function

3.Class variable

4.None of these


Question:
What is a given-when statement in Perl?

1.loop

2.Multiway branch statement

3.function

4.None of these


Question:
What is a hash in Perl?

1.Set of key-value pair

2.Collection storing scalar

3.Collection sorting array

4.None of these


Question:
What is recursion in Perl?

1.Mechanism of a function calling itself again from its body

2.Looping over function with different values

3.Calling overloaded function

4.All of the these


Question:
What will be the output of the following Perl code?

$a = 8;

until ($a <= 7){
    print "Value of a = $a
";
    $a = $a - 1;
}

1.Value of a = 8

2.Infinite loop

3.No run

4.None


Question:
What will be the output of the following Perl code?%lang = ('Perl' => 4, 'Python' => 2, 'Javascript' => 5);
@arr = values %lang;
print @arr

1.PerlPythonJavascript

2. 245

3.425

4.None of these


Question:
Which is a valid way to extract the size of an array in Perl?

1._len(@array_name)

2.@array_name.length()

3.$size = scalar @array_name

4.All of the these


Question:
Which keyword is used to make the current iteration last one?

1.end

2.exit

3.last

4. None of these


Question:
Which of the following is a trait in Perl?

1.is cached

2.is rw

3.is copy

4.All of these


Question:
Which of these is a data type in Perl?





1.Scalars

2.Array

3.Hashes

4.All of these


Question:
Which of these is a decision-making statement in Perl?

1.if unless

2. if-else

3.ladder

4.All of the above


Question:
Which of these is a type of the scalar in Perl?

1.Array

2.String

3.Hash

4.All of these


Question:
Which of these types of string are interpolated?

1.Quote less

2.Single quoted

3.Double quoted

4.None of these


Question:
While in Perl is entry controlled?

1.Yes

2.No

3.Error

4.None of these


More MCQS

  1. Perl Programming MCQs Set 1
  2. Perl Programming MCQs Set 2
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite 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!