Weekend Special Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Question # 4

In the context of Perl user-defined subroutines, which statement is the most accurate?

A.

Variables declared using the my keyword are global in scope.

B.

Variables declared using the local keyword are only available to the subroutine from which they are declared.

C.

Variables declared using the my keyword are available to the calling subroutine.

D.

Variable declared using the local keyword are available to subsequently called subroutines.

Full Access
Question # 5

Consider the following lines of code:

$_ = "This is a test";

s/^([^ ]*)\s*([^ ]*)/$2 $1/;

print;

What is the output of these lines of code?

A.

h Tis a test

B.

is This a test

C.

i Thiss a test

D.

his T is a test

Full Access
Question # 6

Which statement will print the capital attribute of the $kansas object?

A.

print ("capital"=>$kansas);

B.

print {$kansas}=>(capital);

C.

print (capital)<={$kansas};

D.

print $kansas->{"capital"};

Full Access
Question # 7

Which one of the following choices will replace all occurrences of the word perl with the word Perl?

A.

s/Perl/perl/I;

B.

s/"perl"/"Perl"/g;

C.

s/"perl"/"Perl"/;

D.

s/perl/Perl/g;

Full Access
Question # 8

Consider the following statement:

$buffer = a string;

Also consider that a file named test.txt contains the following line of text:

One line of test text.

What is the output of the following lines of code?

$file = "test.txt";

open (OUT, "<$file") || (die "cannot open $file: $!");

read(OUT, $buffer, 15, 4);

print $buffer;

A.

a strOne line of test

B.

a stOne line of tes

C.

a strOne line of tes

D.

a stOne line of test

Full Access
Question # 9

Consider the following program code:

$Animal = Dogs bark;

package Cat;

$Animal = Cats purr;

{

package Fish;

$Animal = Fish swim;

}

package main;

print $Animal;

What is the result of executing this program code?

A.

The code will fail at line 4.

B.

The code will output the following:

Dogs bark

C.

The code will output the following:

Cats purr

D.

The code will output the following:

Fish swim

Full Access
Question # 10

Which Perl debugger commands can be used to step through a script?

A.

b and d

B.

t and c

C.

s and n

D.

X and V

Full Access
Question # 11

Consider that a file named test.txt contains this line of text:

One line of test text.

What is the output of the following lines of code?

$file = "test.txt";

open (OUT, "<$file") || (die "cannot open $file: $!");

seek(OUT, 15, 0);

read(OUT, $buffer, 5);

print $buffer . "\n";

print tell(OUT);

A.

t text

20

B.

t tex

19

C.

t text

19

D.

t tex

20

Full Access
Question # 12

Regular expressions are best used for which task?

A.

To perform arithmetic functions

B.

To determine whether a string matches a specific pattern

C.

To perform spelling checks within text files

D.

To output data to a text file

Full Access
Question # 13

Which keyword indicates an object reference rather than a variable reference?

A.

return

B.

bless

C.

package

D.

object

Full Access
Question # 14

Consider the following lines of code:

$_ = "This is a test";

s/^([^ ]*)\s*([^ ]*)/$2 $1/;

print;

What is the output of these lines of code?

A.

h Tis a test

B.

is This a test

C.

i Thiss a test

D.

his T is a test

Full Access
Question # 15

Consider the following program code:

$Animal = Dogs bark;

package Cat;

$Animal = Cats purr;

{

package Fish;

$Animal = Fish swim;

} p

ackage main;

print $Animal;

What is the result of executing this program code?

A.

The code will fail at line 4.

B.

The code will output the following:

Dogs bark

C.

The code will output the following:

Cats purr

D.

The code will output the following:

Fish swim

Full Access
Question # 16

Consider the following lines of code:

sub mySub {

$_ = @_[1];

$a = shift;

$b = shift;

return $a * $b * $_;

}

mySub(1,2,3);

What is the output of these lines of code?

A.

No output results from this code.

B.

6

C.

2

D.

4

Full Access
Question # 17

Consider the following statement:

@array1 = (9, "A", 0..9, "PERL");

Given this statement, @array1 consists of how many elements?

A.

13

B.

4

C.

12

D.

16

Full Access
Question # 18

Which one of the following statements opens a file for appending?

A.

open(PASSWD, ">/etc/passwd");

B.

open(PASSWD ">/etc/passwd");

C.

open(PASSWD, ">>/etc/passwd");

D.

open(PASSWD "+>/etc/passwd");

Full Access
Question # 19

Which one of the following choices lists the three loop-control commands?

A.

exit, last, loop

B.

next,first,lasr

C.

loop, exit, next

D.

redo, next, last

Full Access
Question # 20

Which of the following choices demonstrates the correct syntax for creating a hash?

A.

%passwds = ("denise", "robert", "yolanda") => ("pass1", "pass2", "pass3");

B.

%passwds() = ("denise", "pass1", "robert", "pass2", "yolanda", "pass3");

C.

%passwds = (denise=> "pass1", robert=> "pass2", yolanda=> "pass3");

D.

%passwds{3} = ("denise", "robert", "yolanda") => ("pass1", "pass2", "pass3");

Full Access
Question # 21

Consider the following program code:

$Animal = Dogs bark;

package Cat;

$Animal = Cats purr;

{

package Fish;

$Animal = Fish swim;

}

package main;

print $Animal;

What is the result of executing this program code?

A.

The code will fail at line 4.

B.

The code will output the following:

Dogs bark

C.

The code will output the following:

Cats purr

D.

The code will output the following:

Fish swim

Full Access
Question # 22

Consider the following program code:

$x = 5;

$y = 10;

while (++$x < 10 && ++$y < 15)

{

print ($x $y );

}

print ($x $y );

What is the result of executing this program code?

A.

The code will output the following:

6 11 7 12 8 13 9 14 10 15

B.

The code will output the following:

6 11 7 12 8 13 9 14 10 14

C.

The code will output the following:

5 10 6 11 7 12 8 13 9 13

D.

The code will output the following:

5 10 6 11 7 12 8 13 9 14

Full Access