New Year Special Limited Time Flat 70% Discount offer - Ends in 0d 00h 00m 00s - Coupon code: 70spcl

CIW 1D0-437 CIW PERL FUNDAMENTALS Exam Practice Test

Page: 1 / 15
Total 149 questions

CIW PERL FUNDAMENTALS Questions and Answers

Question 1

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

Options:

A.

s/Perl/perl/I;

B.

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

C.

s/"perl"/"Perl"/;

D.

s/perl/Perl/g;

Question 2

Which of the following choices demonstrates the correct syntax to pass a reference to a subroutine?

Options:

A.

\@array4;

B.

@array4($ref);

C.

getpass(\@array4);

D.

getpass{@array4};

Question 3

Which one of the following statements uses correct syntax and expressions?

Options:

A.

do (print "Hello $a") until ($a = 10);

B.

do {$a++} until {$a == $b}\;

C.

do {$in = $in++} while ($in < 100);

D.

do ($a++) until ($b = $a);

Question 4

Consider the following code:

%chars = ("a", "100", "b", "90", "c", "80");

Which one of the following choices will reverse the key/value pairing of the code?

Options:

A.

reverse(%chars);

B.

%chars = reverse(%chars);

C.

reverse(%chars) = %chars;

D.

invert(%chars);

Question 5

Consider the following program code:

$y = 1;

$x = 2;

$z = 3;

do

{

print ($y );

} while ($y eq 2);

do

{

print ($x );

} until ($x eq 2);

print ($z );

What is the result of executing this program code?

Options:

A.

The code will output the following:

1 2 3

B.

The code will output the following:

3

C.

The code will output the following:

2 3

D.

The code will output the following:

3 2 1

Question 6

Consider the following lines of code:

sub mySub {

($arg, @args) = @_;

foreach $val (@args) {

$returnVal .= "$arg, $val\n";

}

$returnVal . "" . @args;

}

print &mySub(1, "a value", "another value", "a parameter", "another parameter");

What is the output of these lines of code?

Options:

A.

1, a value 1, another value 1, a parameter 1, another parameter 4

B.

1, a value 1, another value 1, a parameter 1, another parameter

a valueanother valuea parameteranother parameter

C.

1, a value, another value, a parameter, another parameter

a value another value a parameter another parameter

D.

1, a value, another value, a parameter, another parameter 4

Question 7

Consider the program code in the attached exhibit. What is the result of executing this program code?

Question # 7

Options:

A.

The code will output the following:

3 + 5 + 2 + 3 = 13

B.

The code will output the following:

= 3 + 5 + 2 + 3 13

C.

The code will output the following:

= 13 3 + 5 + 2 + 3

D.

The code will fail at line 3 because add is a reserved word.

Question 8

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);

Options:

A.

t text

20

B.

t tex

19

C.

t text

19

D.

t tex

20

Question 9

Consider the following program code:

print(1 );

BEGIN { print(2 ); }

END { print(3 ); }

BEGIN { print(4 ); }

END

{

package MyPackage;

print(5 );

}

What is the result of executing this program code?

Options:

A.

The code will output the following:

1 2 3 4 5

B.

The code will output the following:

2 4 1 5 3

C.

The code will output the following:

2 1 3 4 5

D.

The code will output the following:

2 4 1 3

Question 10

Consider the following program code:

$x = 10;

LOOP: while ($x < 15)

{

print ($x );

if ($x >= 14 && $x <= 20)

{

$x += 2;

redo LOOP;

}

else

{

$x++;

}

}

What is the result of executing this program code?

Options:

A.

The code will output the following:

11 12 13 14 15 16 17 18 19

B.

The code will output the following:

10 11 12 13 14 16 18 20 22

C.

The code will output the following:

10 11 12 13 14 16 18 20

D.

The code will output the following:

10 11 12 13 14 15 16 17 18 19 20

Question 11

Which statement is the most accurate?

Options:

A.

The push function adds elements to the beginning of an array.

B.

The push function removes the first element in an array.

C.

The pop function removes the first element in an array.

D.

The pop function removes the last element in an array.

Question 12

Consider the following program code:

@arrayA = (10, 20, 30);

@arrayB = @arrayA;

$arrayB[1] = 40;

print $arrayA[1];

What is the output of this code?

Options:

A.

10

B.

20

C.

30

D.

40

Question 13

Consider the following program code:

@array = ("one", "two");

push(@array, "three");

shift(@array);

unshift(@array, "four");

pop(@array);

print($array[0]);

What is the output of this code?

Options:

A.

one

B.

two

C.

three

D.

four

Question 14

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?

Options:

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

Question 15

Regular expressions are best used for which task?

Options:

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

Question 16

Consider the following program code:

if ("Apple" gt "Pear")

{

print("True ");

}

else

{

print("False ");

}

if ("Banana" le "Banana")

{

print("True ");

}

else

{

print("False ");

}

What is the result of executing this program code?

Options:

A.

False False

B.

False True

C.

True False

D.

True True

Question 17

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

Options:

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.

Question 18

Consider the following lines of code:

$_ = "This is a test";

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

print;

What is the output of these lines of code?

Options:

A.

h Tis a test

B.

is This a test

C.

i Thiss a test

D.

his T is a test

Question 19

Which of the following tasks is the least effective in reducing errors in Perl scripts?

Options:

A.

Writing pseudo-code before beginning the script

B.

Writing modular code

C.

Declaring and initializing variables

D.

Using the no strict <'refs' | 'vars' | 'subs'>; commands in the code

Question 20

In Perl, packages are used for which task?

Options:

A.

To label a program

B.

To encrypt a program

C.

To create new keywords

D.

To define a namespace

Question 21

Yngve wants to define a character class that includes any alphanumeric word characters. Which one of the following choices is best suited for this requirement?

Options:

A.

/[a-zA-Z_0-9]/;

B.

/^w/;

C.

/[^a-zA-Z_0-9]/;

D.

/[^0-Z$]/;

Question 22

Which of the following choices demonstrates the correct syntax to pass the argument $arg2 to the subroutine getpass?

Options:

A.

getpass($arg2);

B.

call &getpass($arg2);

C.

sub &getpass($arg2);

D.

call getpass($arg2);

Page: 1 / 15
Total 149 questions