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

Question:
 <ARGV>

1.more than one of the above is correct.

2.identifies any command line arguments starting with a-.

3.will read the standard input if no arguments are listed on the command line.

4.can be used to read each line in every file name listed on the command line.


Question:
 In Perl, "stat" returns a thirteen element array with which of the following values?

1. Perl version ID

2.Web server ID

3.Last access

4. Inode number


Question:
 In Perl, scalar variables always begin with a ________ sign.

1.#

2.@

3. %

4.$


Question:
 perl is ____ of grep, tr, sed and awk.

1.subset

2.superset

3. child

4.parent


Question:
 Perl is:

1.A type of interactive web page

2.A programming language

3.An application program

4.A relational database


Question:
 The "%" operator returns:

1.The larger of two numbers e.g. 200 % 20 would return 200

2.A percentage of a number e.g. 200 % 20 would return 40

3.The remainder when one number is divided by another

4.The remainder when one number is divided by another e.g. 18 % 7 would return 5


Question:
 What is a file handle used for?

1.Reading binary data from a file into a scalar variable

2.Finding where a file is on the disc

3.Accessing a disc file or other input/output stream

4.Deleting, moving or renaming a file


Question:
 ___ function is used for joining lists.

1.foreach

2.for

3.split

4.join


Question:
$x = @y[2 .. 4]
  assigns$x the third, fourth and fifth elements of the y array concatenated together.

1.assigns$y[4] to $x.

2.assigns$y[2] to $x.

3.assigns 3 to$x.

4.@a = split(/s/, $str).


Question:
. The $_ variable

1.holds the last pattern matched.

2.holds the output field separator.

3.identifies the current command line argument.

4.none of the above is correct.


Question:
. What will be printed by the code below?
my @a = (0, 1, 2);

my $b = @a;

print $b;

1.0

2.1

3.2

4.3


Question:
CGI is a programming language.

1. True

2.False

3.all of the above

4.none of the above


Question:
For looping in a list, ____ is used.

1. for

2. fordo

3.foreach

4. while


Question:
For splitting a line or expression into fields, __ is used.

1.foreach

2.for

3.split

4.join


Question:
How are multi-line commented in Perl?

1.!

2.=

3. /*

4.#


Question:
How are single-line commented in Perl?

1.! Comment goes here

2.<-- Comment goes here -->

3.# Comment goes here

4.// Comment goes here


Question:
I want to write an appointment manager program for Microsoft Windows users. It must have a GUI, it must be very fast, and it depends on special GUI features found on only Microsoft Windows. What is the best language for the job?

1.Perl

2.Java

3.C++

4.Java, Perl, and C++ are equally good for the job.


Question:
In Perl, a/n ________ is a special character or a sequence that will define the number of times the previous character or sequence appears.

1. character class

2.metacharacter

3.assertion

4.quantifier


Question:
In Perl, the following will result in which of the following, if the prize is currently "5 dollars" print 'You won $prize';

1.You won $5.00

2.You won 5 dollars

3.You won $prize

4.You won $5


Question:
In Perl, which of the following are file handles?

1. stdquit

2. stdend

3.stdin

4.stdout


Question:
In Perl, which switch is used for printing out warnings about typographical errors in your script?

1. -P

2.-W

3.-p

4. -w


Question:
perl also supports use of for loop in the following manner.

for($i=0;$i<3;$i++){ }

1.True

2. False

3.all of the above

4.none of the above


Question:
Perl scripts are text files.

1.True

2.False

3.all of the above

4.none of the above


Question:
Perl was first released in:

1.1978

2.1998

3.Perl hasn't yet been released

4.1988


Question:
PONIE is an acronym for?

1.Perl Of New Information Engine

2.Perl Of Next Information Engineering

3.Perl On Next Internal Engine

4.Perl On New Internal Engine


Question:
The following will display :

perl -e ‘print “UNIX” x 10 . “
” ;’

1.UNIX

2.UNIX 10 times

3. error message

4.


Question:
The printf format "%6.2f" displays a number …

1.At least six columns wide in total, with two figures after the decimal place

2.Exactly six digits before the decimal place, and two digits after

3.At least six digits before the decimal place, and two digits after

4.Exactly six columns wide in total, with two figures after the decimal place


Question:
The shebang line is _______

1. #!

2.!#

3.#$

4.$#


Question:
The statement open (FH,"abc.txt");

1.opens the file abc.txt for overwriting

2. opens the file abc.txt for reading

3.contains an error, so won't compile

4.opens the file abc.txt for appending


Question:
The value of the expression $yards += 10

1.is 10.

2.is true.

3.cannot be determined from the information given.

4.relies on which command line arguments were used.


Question:
There is another popular scripting language called Python. Like Perl, it reads and runs scripts in one step instead of compiling them ahead of time. What would I need on my computer to use Python?

1.A Python compiler

2.A Python editor

3.A Python virtual machine

4.A Python interpreter


Question:
What is Perl?

1.Practical Extraction and Report Language

2.Practice for Exclusive and Report Language

3.Practical Extraction and Report Learning

4.Practical Exclusive and Report Language


Question:
What is the result of this script: $a = "This is Perl"; $b="This is Perl

"; chomp($a); chomp($b);?

1.$a contains "This is Perl"; $b contains "This is Perl "

2.$a contains "This is Per"; $b contains "This is Perl "

3.$a contains "This is Perl"; $b contains "This is Perl"

4.$a contains "This is Perl "; $b contains "This is Perl "


Question:
What output will be generated by this statement: print("Hello
world

This is Perl
");?

1. Hello world This is Perl

2.Hello world This is Perl

3.Hello World This is Perl

4.Hello world This is Perl


Question:
What will be printed by the code below?
58% on 4261 times asked

my $val = 'x';

print ref($val);

1.SCALAR

2.empty value

3.STRING

4."not a reference"


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

print ref($val);

1.empty value

2.ARRAY

3.HASH

4.Scalar


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

1."Hello world"

2."Helloworld"

3."Hello"

4."world"


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 among the following statements are true with respect to Perl? S1: Perl is procedural in nature S2: Perl do automatic data-typing S3: All variables are marked with leading sigils

1.S1 and S2

2.S2 and S3

3.S1 and S3

4.S1,S2 and S3


Question:
Which are the permitted file extensions of perl?

1..pl,.p

2..t,.p

3..pl, .pm

4..pl,.perl


Question:
Which brackets do you use to change the order of precedence of operations?

1.Curly braces

2.Square brackets

3.Round brackets

4.You don't use brackets in Perl - you write in RPN (Reverse Polish Notation)


Question:
Which keyword can be used instead of print to have the carriage return added automatically? (v5.10 or higher)

1.println

2.$print

3.say

4.out


Question:
Which of the following commands will turn a scalar ($str)into an array of characters?

1.@a = split($str).

2.@a = split(/s/, $str).

3.This task can be done in Perl but none of the above commands do it.

4.assigns 3 to$x.


Question:
Which of the following tests if the string held in $qn includes the word "perl"?

1.if ($qn =~ /perl/) .....

2.if ($qn == "perl") ....

3.if ($qn = "perl") .....

4. if ($qn eq "perl") .....


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 Carribean cruise in 2006 on which you can meet some of the Perl gurus.


Question:
Which option can be used to use perl on the command line?

1.$ perl -e

2.$ perl -i

3.$ perl -p

4.$ perl -r


Question:
Which statement enables Plain Old Documentation?

1.=cut

2.=doc

3.=pod

4.=end


Question:
Which symbol is owned by the Perl Foundation?

1.Elephant

2.Onion

3.Parrot

4.Turnip


Question:
Who designed and developed Perl?

1.Larry Wall

2.Guido van Rossum

3.Ross Ihaka

4.Martin Odersky


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!