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

Question:
 If a variable is undefined, its value is ____

1.0

2. 1

3.NULL

4.garbage


Question:
 In Perl, the words function and subroutines are used interchangeably.

1.True

2.False

3.All the above

4.none of the above


Question:
 It is often more convenient to save perl program files with ____ extension

1. .gp

2..sh

3..awk

4..pl


Question:
 substr function is also used to alter an existing string.

1.True

2.False

3.all of the above

4.asStub()


Question:
 The "+= is which type of operator?

1.comparison operators

2.Arithmetic operators

3.Increment/ decrements operators

4.Assignment operators


Question:
 The getdir command

1.Reads a single file name from an open directory handle

2.Reads the rest of the file names from an open directory handle

3.Only works after anopendir command

4.Is not a perl command


Question:
 To repeat a string, perl uses ___ operator.

1. /

2..

3.x

4.\


Question:
 What will be printed by the code below? my $val = {}; print ref($val);

1.empty value

2.Array

3.Hash

4.Scalar


Question:
 When a string is used for numeral computations, perl converts it into

1.character

2.floating point number

3.number

4.boolean value


Question:
 Which function can combine the functionalities of push, pop, unshift and shift?

1.splice

2.add

3.delete

4.split


Question:
 ___ function returns the first occurrence of a character in a string.

1.string

2.index

3. split

4. length


Question:
A perl program runs in a special interpretive mode.

1.True

2.False

3.all of the above

4.none of the above


Question:
Command line arguments in Perl are stored in

1.Scalar

2. Resource

3.Array

4.Hash


Question:
For deleting the elements from the left of the array ___ function is used.

1. pop

2.push

3.queue

4.shift


Question:
For deleting the elements from the right of the array ___ function is used.

1.pop

2.push

3.queue

4.shift


Question:
For extracting a substring, ____ function is used.

1.string

2.index

3.substr

4.length


Question:
How do you perform a forward declaration of a subroutine performed?

1.forward sub name

2. sub name

3.forward name

4.sub name {}


Question:
It is often more convenient to save perl program files with ____ extension.

1. .gp

2. .sh

3. .awk

4. .pl


Question:
Language which features rich text processing capabilities and flexibility is

1.Perl

2. C

3.Visual Basic

4.Ada


Question:
perl variables have no type and no initialization.

1.True

2.False

3.all of the above

4.none of the above


Question:
Scalar is denoted by_______in Perl.

1.#

2. $

3.%

4.^


Question:
Scalar stores

1.Multiple value

2.Single value

3.Double value

4. Float value


Question:
Select comparison operator from the options.

1. *=

2. &&

3.!=

4.=


Question:
Select the option which allows the user to scroll through the entire program line by line in Perl.

1.Using the strict pragma

2.Using the built-in debugger

3.Using the string pragma

4.Using the built-in error


Question:
The command @x=(1. .10) will assign first ten integer values to the array ‘a’.

1.True

2. False

3.all of the above

4.none of the above


Question:
The ___ prefix to an array name signifies the last index of the array.

1.$0

2. $#

3. #$

4.$_


Question:
To add elements to the left side of the array ____ function is used.

1.pop

2.push

3.queue

4.unshift


Question:
To add elements to the right side of the array ____ function is used.

1.pop

2. push

3.queue

4. unshift


Question:
To test whether perl is in your PATH, use ____

1. perl -e

2.perl -i

3. perl -el

4. perl -ed


Question:
We can specify filenames in command line using perl.

1.True

2.False

3.all of the above

4.none of the above


Question:
We can use find command for testing files with perl.

1.True

2.False

3.all of the above

4.none of the above


Question:
What will be the value in the variable $a after these two statements: $a = "Happy"; $a = "Sunday";?

1."Happy Sunday"

2."HappySunday"

3."Happy"

4."Sunday"


Question:
What will display the list of warning messages regarding the code?

1.Strict pragma

2.The -w Command-line argument

3.Using the built-in debugger

4.none of the above


Question:
When a string is used for numeral computations, perl converts it into ___

1.character

2. floating point number

3. number

4.boolean value


Question:
When the "require" function loads?

1.Runtime

2.Compile time

3.Both

4.none of the above


Question:
When you create a variable, you may assume it starts off containing

1.1

2.You may not make any assumption

3. The boolean value "false"

4.A null string (or 0 arithmetically)


Question:
When you're pattern matching, you describe the pattern using

1.A string in double quotes

2.A MySQL select statement

3.A regular expression

4.A template


Question:
Which escape character is used for identifying a word character?

1.s

2. d

3. w

4.


Question:
Which function is used by perl for displaying the length of a string?

1.string

2.len

3.split

4.length


Question:
Which function is used by perl for reversing a string?

1.rev

2.reverse

3.split

4.substr


Question:
Which function is used for handling substitutions in perl?

1.tr

2.s

3.str

4. tr and s


Question:
Which of the following are concatenation operators?

1./

2. .

3._

4. \


Question:
Which of the following is referred to as default variable?

1.$0

2.$1

3.$!

4. $_


Question:
Which of the following is used in perl?

1.else if

2. elseif

3.elsif

4.elif


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

1.while

2.until

3.for

4.none of the above


Question:
Which of these is NOT available for Perl

1.Perl, legally, for free

2.Individual and site licenses

3.Full documentation of the language which you can print out yourself

4.A Caribbean cruise in 2006 on which you can meet some of the Perl gurus


Question:
Which one of the following is the most powerful filter?

1. awk

2.grep

3. sed

4.perl


Question:
___ function is used for removing the last character from the line.

1.cut

2.chop

3.erase

4. split


Question:
___ is known as range operator.

1.. .

2. $1

3. $.

4. $_


Question:
___ operator is used for selecting current line number.

1.$0

2.$1

3.$.

4. $_


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!