nerdexam
CIW

1D0-437 · Question #70

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.}…

The correct answer is C. Baseball. See the full explanation below for the reasoning.

Question

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

  • ANo output is generated due to an error in line 2.
  • BBasketball
  • CBaseball
  • DNo output is generated due to an error in line 3.

How the community answered

(34 responses)
  • A
    6% (2)
  • B
    15% (5)
  • C
    74% (25)
  • D
    6% (2)

Community Discussion

No community discussion yet for this question.

Full 1D0-437 Practice