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

Discussion in 'C++' started by Minti, Jul 19, 2004.

  1. Minti

    Minti Guest

    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



    /// Test5.cpp
    int main(void)
    {

    int *x;
    *x = 0;
    return 0;
    }


    F:\test# cl /EHsc /Wall /WX /c test5.cpp
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for
    80x86
    Copyright (C) Microsoft Corporation 1984-2001. All rights reserved.

    test5.cpp
    f:\test\test5.cpp(5) : error C2220: warning treated as error - no
    'object' file generated
    f:\test\test5.cpp(5) : warning C4700: local variable 'x' used without
    having been initiali
    zed


    What part of the sentence "f:\test\test5.cpp(5) : warning C4700: local
    variable 'x' used without having been initialized" Don't you
    understand? Hint: It's in English.

    Also

    Please come in the office and collect your pink slip.
    {1} Non-Existent.


    --
    Imanpreet Singh Arora
    isingh AT acm DOT org
    Minti, Jul 19, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rohi
    Replies:
    47
    Views:
    56,948
    drithi
    Sep 20, 2011
  2. Snyke
    Replies:
    3
    Views:
    986
    Julie
    Jul 19, 2004
  3. Steve Summit
    Replies:
    0
    Views:
    1,099
    Steve Summit
    Jul 1, 2003
  4. Steve Summit
    Replies:
    0
    Views:
    885
    Steve Summit
    Jul 1, 2003
  5. Steve Summit
    Replies:
    0
    Views:
    436
    Steve Summit
    Aug 1, 2003
Loading...

Share This Page