Reply to Re: Really hardcore question about PHP needed :)

Your name:

Reply:


Posted by Steve on 04/18/07 17:34

"Toby A Inkster" <usenet200703@tobyinkster.co.uk> wrote in message
news:mothf4-pec.ln1@ophelia.g5n.co.uk...
| Steve wrote:
| > Toby A Inkster:
| >
| > | Question 1:
| > |
| > | <?php
| > | $i = 5;
| > | $i = 5 + $i++;
| > | echo $i; // What does this print?
| > | ?>
| >
| > i see you've taken the $i = $i + $i++ discussion here. you do realize
this
| > effects ALL c-ish languages including javascript, right? :)
|
| Indeed I do.
|
| > since he's betting his 'c' developers, they'll laugh that he thinks it
| > is an advanced question.
|
| The OP didn't mention of whom he was intending to ask the questions in the
| original post. And even so, it's the kind of question that it's very easy
| to make a mistake answering. The so called "smiple" question. Think a
tonne
| of lead vs a tonne of feathers.

i know...he multi-posted to just about every other php ng out there, and in
one of them he mentioned it was a bet between php and c developers. i just
couldn't remember if it was in this group that he said it.

good point about simple being most complex. although i'm not sure i get the
ton of lead v ton of feathers...still a ton, right?

| > | Question 2:
| > |
| > | Which of the following is wrong? (There may be more than one
| > | which are wrong.)
| > |
| > | * in_array($needle, $haystack);
| > | * stristr($needle, $haystack);
| > | * strpos($needle, $haystack);
| > | * preg_match($needle, $haystack);
| >
| > NONE of the above are wrong. you fail to make constraints on $needle and
| > $haystack in each function.
|
| One assumes of course, that you are intending to search $haystack for
| $needle. That is the normal usage of those metasyntactic variables, and it
| is used consistently in the PHP documentation. Anyone not understanding
| that should be failed automatically anyway.

brrrrr! wrong answer. on tests, assumption is the err of the test maker, not
the test taker! why? because most test's questions are trying to see the
extent of one's ability to reason and think clearly through the states
scenarios and give the best solution. it is the test taker's assumption that
keeps him from scoring high marks on iq tests...see mensa.org if you'd care
to argue this further. as a member, i can tell you there is a whole world of
test creation strategy out there and *most* involve duping the taker into
making an assumption. it simply seperates the grain from the chaff.

| http://en.wikipedia.org/wiki/Metasyntactic_variable#Needle_and_haystack

OMFG! your reference is wiki? ROFLMFAO! so, since $needle and $haystack are
'reserved' words to you, do you have any other magic numbers...errr...i
mean, variables that a test taker should know? that's especially true if
they're from another locale than you - they just may have never encountered
such a thing as 'need' or 'haystack'.

LOL

| > | Question 3:
| > |
| > | Describe the output of this code:
| > |
| > | <?php
| > | function print_defined_vars ()
| > | {
| > | print_r(get_defined_vars());
| > | }
| > | $a = 1;
| > | $b = 2;
| > | print_defined_vars();
| > | ?>
| >
| > uhmmm, is this a head-scratcher?
|
| Nope. But it's more fun to pick an innocuous looking question with a
| gotcha that they might not spot, than to just post an enormous 1000 line
| chunk of impenetrable code and say "find the syntax error in that".

i wouldn't say the latter is 'advanced' questioning either; just highly
inefficient. i like the ones like:

$value = 0;
for ($incrementor = 0; $incrementor < 10; $incrementor++)
{
$value += $value % $incrementor;
}

what is the value of $incrementor?

most actually try to calculate in their head or on the test what the value
of $value is. duh. btw, that form of questioning is bating
assumption...which we've already covered. :)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация