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)- A6% (2)
- B15% (5)
- C74% (25)
- D6% (2)
Community Discussion
No community discussion yet for this question.