i = 10; result = ++i - --i; How result become ZERO

N

Nick Keighley

the test is broken. It does not bode well for the technical competance
of the company.

Don't Do That
So your answer is to redefine the question because you can't cope with
the problem and answers as given? You are no longer answering the
question but questioning the question.

In a computer science exam I answered "the question you meant to ask
was ...". Since I got a good mark in this exam I assume I was right. I
think it highly likely that the OP (or someone else) mistranscibed
it). People who write tests are not god-like beings.
As others have pointed out, it is undefined, therefore the proper
answer is: error.

yes but it may not give an "error" as in a diagnstic or crash

I think the correct response is that apocryphal japanese word
"mu" ("unask the question")
UB means you cannot predict what the result will be because the
standard does not define what implementations are required to do. It
is open to interpretation by the implementation, therefore you cannot
depend on the result from one implementation to another or one version
of an implementation and another.

hell, or even one line to another

The [crap code] seems to be intended to be a precedence problem where the
tester is seeking to know if the student understands pre-increment and
pre-decrement but the code is erroneous on its face when interpreted
against the current standard.

against *all* versions of the C standrad

<snip>
 
M

MJ_India

[snip]


As a not very interested bystander, it would seem the test is wrong.  It
strikes me as a very poor question to include in a multiple choice test; the
code should not have been written, as the FAQ makes clear.  It is barely
*conceivable*  that they wanted "Error" as an answer.  In US English that
would  make little sense, but there is English and there is English, as you
well know.
There must be a huge number of applicants in India when  they have to resort
to such a crude means of testing.

Based on the questions and code I've seen here and elsewhere from
students and beginning programmers in India, I've come to the
following conclusions:

1.  Indian universities and tech schools are using *very* out of date
    materials and tools (Turbo C appears to be the most advanced
    compiler available);

2.  The reference materials are of uniformly poor quality and teach
the
    kind of bad practice and wrong concepts that infested code written
    in the US back in the early '90s;

3.  These bad practices and wrong concepts have become
institutionalized
    in the Indian software industry.

I'm not surprised by seeing an interview question like that at all.

I am afraid you have built your own conception by glancing a very
small part of India or so called Indian Engineer and you are
_no_different_ from OP. In every country there are good and bad
programmers, whether it is India or US or any other part of the world.

If you can not explain the difference (actually don't want to explain)
between well defined LOC and implementation dependent/unspecified/
undefined LOCs, and the question frustrates you, why don't you better
ignore it?
So, I sincerely request you not to judge and share your judgments
instead of C on this group.
 
L

Lakshmi Sreekanth

[snip]


As a not very interested bystander, it would seem the test is wrong.  It
strikes me as a very poor question to include in a multiple choice test; the
code should not have been written, as the FAQ makes clear.  It is barely
*conceivable*  that they wanted "Error" as an answer.  In US English that
would  make little sense, but there is English and there is English, as you
well know.
There must be a huge number of applicants in India when  they have to resort
to such a crude means of testing.

Based on the questions and code I've seen here and elsewhere from
students and beginning programmers in India, I've come to the
following conclusions:

1.  Indian universities and tech schools are using *very* out of date
    materials and tools (Turbo C appears to be the most advanced
    compiler available);

2.  The reference materials are of uniformly poor quality and teach
the
    kind of bad practice and wrong concepts that infested code written
    in the US back in the early '90s;

3.  These bad practices and wrong concepts have become
institutionalized
    in the Indian software industry.

I'm not surprised by seeing an interview question like that at all.


For me, the interview was conducted by US company. That test paper
were prepared by any one either Indian or American or .........
So, do not blame the country.........
As you said, American's following good/latest standard's. But, for
this case not able to post the correct, specific answer.


BR,
Lakshmi Sreekanth
 
N

Nick Keighley

On Sep 21, 11:31 pm, John Bode <[email protected]> wrote:

I am afraid you have built your own conception by glancing a very
small part of India or so called Indian Engineer and you are
_no_different_ from OP. In every country there are good and bad
programmers, whether it is India or US or any other part of the world.

If you can not explain the difference (actually don't want to explain)
between well defined LOC and implementation dependent/unspecified/
undefined LOCs,

Lines Of Code? I usually use the term as a measure of program size. I
get the idea you're using it some other way. The code Lakshmi
Sreekanth posted was an example of undefined behaviour. So it wasn't
well defined nor implementation defined.
and the question frustrates you, why don't you better
ignore it?

who appeared to be frustrated? The problem is asking about the
meaning of semething that inherently has no meaning.
 
W

Willem

Lakshmi Sreekanth wrote:
)> Based on the questions and code I've seen here and elsewhere from
)> students and beginning programmers in India, I've come to the
)> following conclusions:
)>
)> 1. ?Indian universities and tech schools are using *very* out of date
)> ? ? materials and tools (Turbo C appears to be the most advanced
)> ? ? compiler available);
)>
)> 2. ?The reference materials are of uniformly poor quality and teach
)> the
)> ? ? kind of bad practice and wrong concepts that infested code written
)> ? ? in the US back in the early '90s;
)>
)> 3. ?These bad practices and wrong concepts have become
)> institutionalized
)> ? ? in the Indian software industry.
)>
)> I'm not surprised by seeing an interview question like that at all.

I theorize that it is not incompetence, but culture that makes Indian
people prone to such behaviour. I theorize that in India, it is a sign
of weakness to ask for help (as opposed to asking for the answer to a
specific question), and to accept offered help as well.

The fact that in Indian language, 'question' and 'doubt' are
interchangable, and that they choose the English 'doubt' as the
translation, could indicate that questioning is inherently negative
in India.

) For me, the interview was conducted by US company. That test paper
) were prepared by any one either Indian or American or .........
) So, do not blame the country.........

If it happens once, it's coincidence, if it happens a lot, it's a pattern.

) As you said, American's following good/latest standard's. But, for
) this case not able to post the correct, specific answer.

You just corroborated my point that people from India do not want help,
but only specific answers to their questions.

For the last time: There is no correct answer, the question is faulty.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
 
K

Keith Thompson

Nick Keighley said:
That's not quite the rule.
[...]

I was trying to explain in plain english rather than standardese. [...]

Sometimes you have to lie a little to achieve a simple explanation.

That doesn't work around here; some jerk like me will always call
you on it.
 
K

Kenny McCormack

Nick Keighley said:
That's not quite the rule.
[...]

I was trying to explain in plain english rather than standardese. [...]

Sometimes you have to lie a little to achieve a simple explanation.

That doesn't work around here; some jerk like me will always call
you on it.

Wow. Just wow.

I'm impressed (seriously!).
 
T

Tom St Denis

S

Seebs

As you said, American's following good/latest standard's.

Two things:

1. Plurals do not take apostrophes.
2. The idea that most Americans, or even many, follow good standards
is ludicrous.
But, for
this case not able to post the correct, specific answer.

Every single answer which is correct has been posted.

There may, however, be no correct answer. What is the name of your
child who successfully colonized Mars? You must give a specific name.

This question has exactly as many correct answers as "what is the value
of x after x = ++i - --i;" does.

-s
 
G

Geoff

On Wed, 22 Sep 2010 01:54:06 -0700 (PDT), Nick Keighley

[snip]
yes but it may not give an "error" as in a diagnstic or crash

I agree, I regard the error answer to be applicable to the problem as
a whole rather than the result.
I think the correct response is that apocryphal japanese word
"mu" ("unask the question")

Very Zen. In Chinese the word is bu, "Not!"
 
S

Squeamizh

Lakshmi Sreekanth wrote:

)> Based on the questions and code I've seen here and elsewhere from
)> students and beginning programmers in India, I've come to the
)> following conclusions:
)>
)> 1. ?Indian universities and tech schools are using *very* out of date
)> ? ? materials and tools (Turbo C appears to be the most advanced
)> ? ? compiler available);
)>
)> 2. ?The reference materials are of uniformly poor quality and teach
)> the
)> ? ? kind of bad practice and wrong concepts that infested code written
)> ? ? in the US back in the early '90s;
)>
)> 3. ?These bad practices and wrong concepts have become
)> institutionalized
)> ? ? in the Indian software industry.
)>
)> I'm not surprised by seeing an interview question like that at all.

I theorize that it is not incompetence, but culture that makes Indian
people prone to such behaviour.  I theorize that in India, it is a sign
of weakness to ask for help (as opposed to asking for the answer to a
 specific question), and to accept offered help as well.

The fact that in Indian language, 'question' and 'doubt' are
interchangable, and that they choose the English 'doubt' as the
translation, could indicate that questioning is inherently negative
in India.

Absolutely hilarious. I hope all your "theories" are confined to idle
usenet posts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top