Re: frequently asked C and C++ interview questions along with their answers

Julie wrote:
> Walter wrote:
> >
> > "Julie" <> wrote in message
> > news:...
> > > You didn't answer the question though. "What's wrong here?"
> > >
> > > You can't answer the question, because you don't know the
requirement.
> >
> > It's hard to see a candidate being offered the job after trying
that tactic.
>
> Well then, that is the misfortune of the company.
>
> I find it somewhat dichotomous how we programmers deal with extreme
precision,
> something that isn't precise usually doesn't work or worse, yet we
allow
> ourselves to be treated as morons and never attempt to establish what
is really
> intended by those that we work for.
>
> My original response was somewhat facetious, intended to bring up
some points
> about the interviewing process and the capacity of the interviewer.

May, I ask you to then stop posting. If you really wanted to be
facetious, you could have added a at the end of your message.
Though it won't have guranteed that it would not have been
minunderstood.
> Honestly, if I were in an interview like that:
>
> interviewer: <code snippet>, "what's wrong with this code?"
>
> me: "Without knowing the specific requirements, it is hard to really
determine
> what is really 'wrong' as it looks like it would compile just fine to
me. I do
> see it resulting in undefined behavior when executing, however. Can
you tell me
> what the requirements are?."
>
> interviewer: "I'll get to the requirements in a sec; what do you mean
by
> undefined behavior?"
>
> me: "Well, there is a problem when derefrencing x because it hasn't
been
> initialized. The standard indicates that doing such results in
'undefined
> behavior', so just about anything can happen at that point, but will
probably
> result in a crash."
>
> interviewer: "By the way, the requirement was to 'write a program
that exhibits
> undefined behavior' -- nice job, you have been the only candidate to
realize
> that requirements are an important part to the development process."

WOW! I am really-really impressed with this one. Your Job is guaranteed
in my LISA software inc. {1} Not because you were specific about
requirements, any arse-hole can be good at that. But most importantly
you are capable of explaining and writing the problem without
requirements. Just to be precise, you are breaking your own premise.
Your premise was that you were "given" a code snippet not that you were
"write".

Also could I get your explanation/definition of wrong-hood? Why do you
say that that program will compile "just fine"? It does not on mine

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!