U.S. Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend 200-710 Exam - Topic 6 Question 102 Discussion

What is the output of the following code?function ratio ($x1 = 10, $x2){if (isset ($x2)) {return $x2 / $x1;}}echo ratio (0);
D) A warning, because $x2 is not set
A) 0
B) An integer overflow error
C) A warning, because $x1 is not set
E) A floating-point overflow error
F) Nothing

Zend 200-710 Exam - Topic 6 Question 102 Discussion

Actual exam question for Zend's 200-710 exam
Question #: 102
Topic #: 6
[All 200-710 Questions]

What is the output of the following code?

function ratio ($x1 = 10, $x2)

{

if (isset ($x2)) {

return $x2 / $x1;

}

}

echo ratio (0);

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Hoa
11 hours ago
Definitely not an integer overflow error!
upvoted 0 times
...
Clay
2 months ago
I think it's a warning because $x2 isn't set.
upvoted 0 times
...
Tina
2 months ago
The output will be 0.
upvoted 0 times
...
Luke
2 months ago
I’m leaning towards option D, but I’m not completely confident since I can’t recall how PHP handles default values in this context.
upvoted 0 times
...
Marti
2 months ago
This reminds me of a practice question where a missing parameter caused a warning. I feel like that might happen here too.
upvoted 0 times
...
Shad
3 months ago
I remember something about default parameters, but I’m confused if $x2 being unset will cause a warning or not.
upvoted 0 times
...
Ula
3 months ago
I think the function will return 0 since $x2 is passed as 0, but I'm not entirely sure about the default value of $x1.
upvoted 0 times
...

Save Cancel