RE: Re[2]: [PHP] PHP Interview questions
| From: | Jay Blanchard | Date: | Wed, 27 Aug 2003 16:13:18 +0000 |
| Subject: | RE: Re[2]: [PHP] PHP Interview questions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160932@lists.php.net to get a copy of this message | ||
[snip]
JB> You are presented with three crates. One is labled 'apples', one is
JB> labled 'oranges', one is labled 'apples and oranges'. The lables
have
JB> been mis-applied with none of the lables being on the correct crate.
To
JB> be perfectly clear ( :7) Brian! ) one crate contains apples, one
JB> contains oranges, and one contains apples and oranges...but you do
not
JB> know which crate contains which fruits. Can you draw one fruit from
a
JB> single crate (without being able to see inside the crate) and
determine
JB> where the labels should be re-applied in order to correct the
problem?
JB> --
JB> PHP General Mailing List (http://www.php.net/)
JB> To unsubscribe, visit: http://www.php.net/unsub.php
take fruit from apples/oranges
if(apple)
move apple_label to current
move orange_label to old apple
move apples/oranges_label to old orange
else
move orange_label to current
move apple_label to old_orange
move apples/oranges_label to old apple
endif
[/snip]
You are taking a fruit from the crate labeled "apples and oranges",
right? If so, you would be correct. Well done!