Massive Summer Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: netdisc

CIW 1D0-437 CIW PERL FUNDAMENTALS Exam Practice Test

Demo: 22 questions
Total 169 questions

CIW PERL FUNDAMENTALS Questions and Answers

Question 1

Which one of the following choices is a unary operator that can apply to only a single variable?

Options:

A.

++

B.

**

C.

/

D.

?

Question 2

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 3

Which line of code represents the correct syntax to establish a reference to a database handle?

Options:

A.

$dbh = DBI::connect("dbi:mysql:myPhoneBook");

B.

$dbh = DBD:->connect("dbi::mysql::myPhoneBook");

C.

$dbh = DBD::connect("mysql:dbi:myPhoneBook");

D.

$dbh = DBI->connect("dbi:mysql:myPhoneBook");

Question 4

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 5

Consider the following lines of code:

1.$playerStr = "Today's player is Bob Petit.";

2.if($playerStr =~ /[Ruth|Gehrig|DiMaggio]/) {

3. $game = "Baseball";

4.}else{

5. $game = "Basketball";

6.}

7.print $game;

What is the output of these lines of code?

Options:

A.

No output is generated due to an error in line 2.

B.

Basketball

C.

Baseball

D.

No output is generated due to an error in line 3.

Question 6

Which of the following correctly creates a SQL statement that will insert the values of the $name and $age variables into a database? The statement is assigned to the $sqlStmt variable. Assume a CHAR data type for $name and an INT data type for $age.

Options:

A.

$sqlStmt = q{INSERT INTO aTable (NAME, AGE) VALUES ($name, $age)};

B.

$sqlStmt = q{INSERT INTO aTable (NAME, AGE) VALUES ($name\, $age)};

C.

$sqlStmt = qq{INSERT INTO aTable (NAME, AGE) VALUES ($name, $age)};

D.

$sqlStmt = qq{INSERT INTO aTable (NAME, AGE) VALUES (\$name\, $age)};

Question 7

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?

Options:

A.

No output results from this code.

B.

6

C.

2

D.

4

Question 8

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 9

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

Options:

A.

The code will output the following:

20 100 Apple Grapefruit Orange

B.

The code will output the following:

Apple Grapefruit Orange 20 100

C.

The code will output the following:

100 20 Apple Grapefruit Orange

D.

The code will output the following:

Orange Grapefruit Apple 100 20

Question 10

Consider the following statement:

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

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

Options:

A.

13

B.

4

C.

12

D.

16

Question 11

Consider the following assignments:

$x = 9

$y = 7

$z = 5

Given these assignments, which one of the following expressions evaluates as true?

Options:

A.

($x - $y) != ($y - $z);

B.

($z * 2) <= $x;

C.

($y + $z + $x) = $y*3;

D.

($x 2) > $y;

Question 12

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 13

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?

Options:

A.

No output results from this code.

B.

6

C.

2

D.

4

Question 14

In Perl, modules are used for which task?

Options:

A.

To organize packages

B.

To provide code reusability

C.

To separate code in a file

D.

To create separate namespaces

Question 15

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

Options:

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

Question 16

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

Options:

A.

The code will output the following:

BOBBY

B.

The code will output the following:

GERTRUDE

C.

The code will output the following:

JOHN

D.

The code will output the following:

ROBERT

Question 17

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

Options:

A.

b and d

B.

t and c

C.

s and n

D.

X and V

Question 18

Which of the following is a valid subroutine name?

Options:

A.

_funct7

B.

get-pass

C.

#sub1

D.

@passwd

Question 19

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 20

Which statement is the most accurate?

Options:

A.

The unshift function removes elements from the beginning of an array.

B.

The unshift function adds elements to the end of an array.

C.

The shift function adds elements to the end of an array.

D.

The shift function removes elements from the beginning of an array.

Question 21

Consider the following program code:

package Dog;

$string = Walk the dog.;

if($string eq Walk the dog.)

{

package Cat;

$string = Pet the cat.;

print($string\n);

}

print ($string\n);

What is the result of executing this program code?

Options:

A.

The code will output the following:

Pet the cat.

B.

The code will output the following:

Walk the dog.

C.

The code will output the following:

Pet the cat.

Walk the dog.

D.

The code will output the following:

Walk the dog.

Pet the cat.

Question 22

Which line of code represents the correct syntax to establish a reference to a database handle?

Options:

A.

$dbh = DBI::connect("dbi:mysql:myPhoneBook");

B.

$dbh = DBD:->connect("dbi::mysql::myPhoneBook");

C.

$dbh = DBD::connect("mysql:dbi:myPhoneBook");

D.

$dbh = DBI->connect("dbi:mysql:myPhoneBook");

Demo: 22 questions
Total 169 questions