CIW PERL FUNDAMENTALS v5.0 (1D0-437)

Page:    1 / 10   
Total 149 questions

Which one of the following choices lists valid assertions that represent places within a string?

  • A. \b, \B, \x, \X
  • B. \A, \B, \Z, \G
  • C. \z, \Z, \g, \y
  • D. \Y, \X, \Z, \A


Answer : B

Which one of the following choices uses the correct syntax for a valid array assignment?

  • A. @cities = Akron, Memphis, Ogden, Phoenix;
  • B. @cities =~ ("Akron, Memphis");
  • C. @cities =~ (Akron, Memphis, Ogden, Phoenix);
  • D. @cities = ("Akron");


Answer : D

Consider the following assignments:
$x = 9
$y = 7
$z = 5
Given these assignments, which one of the following expressions evaluates as true?

  • A. ($x - $y) != ($y - $z);
  • B. ($z * 2) <= $x;
  • C. ($y + $z + $x) = $y*3;
  • D. ($x 2) > $y;


Answer : C

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


Answer : B

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?

  • 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


Answer : B

In Perl, packages are used for which task?

  • A. To label a program
  • B. To encrypt a program
  • C. To create new keywords
  • D. To define a namespace


Answer : D

Consider the following program code:
@array = ("Y", "W", "X");
@array = sort(@array);
unshift(@array, "Z");
print(@array[0]);
What is the output of this code?

  • A. W
  • B. X
  • C. Y
  • D. Z


Answer : D

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;


Answer : D

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

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


Answer : D

Consider the following program code:
%color = (sun => yellow, apple => red);
reverse(%color);
@colorKeys = sort(keys(%color));
foreach(@colorKeys)
{
print($color{$_} . );
}
What is the result of executing this program code?

  • A. The code will output the following: apple sun
  • B. The code will output the following: sun apple
  • C. The code will output the following: red yellow
  • D. The code will output the following: apple red sun yellow


Answer : C

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.

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


Answer : C

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

  • A. ++
  • B. **
  • C. /
  • D. <?>?


Answer : A

Consider the following code block:
BEGIN {print ("Jan ");}
BEGIN {print ("Feb ");}
END {print ("Mar ");}
END {print ("Apr ");}
Print ("May ");
What is the result of this code block?

  • A. Jan Feb May Apr Mar
  • B. Jan Feb Mar Apr May
  • C. Mar Apr May Jan Feb
  • D. May Jan Feb Mar Apr


Answer : A

Which of the following accurately describes the roles of the Database Interface Module
(DBI) and the Database Driver Module (DBD)?

  • A. DBI transmits instructions to a database; DBD directs method calls to DBI.
  • B. DBD transmits instructions to a database; DBI directs method calls to DBD.
  • C. DBI makes available database-specific code; DBD transmits method calls to DBI.
  • D. DBD makes available database-specific code; DBI translates method calls to DBD.


Answer : B

Consider the following program code:
1.$x = 100;
2.$y = "-25";
3.$sum = $x + $y;
4.
5.print $sum;
What is the result of executing this program code?

  • A. The code will output the following: 100-25
  • B. The code will output the following:
  • C. The code will fail at line 3 because $y contains string data.
  • D. The code will output the following: 125


Answer : B

Page:    1 / 10   
Total 149 questions