Interview questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj

    Interview questions

    Dear friends, I have one more questions for everyone in the newsgroup:

    I am preparing for an interview on UNIX/C++. Could you please identify some
    of the most important questions which might be asked, so that I could best
    prepare for it?

    Thank you,
    C++J


  • Karl Heinz Buchegger

    #2
    Re: Interview questions

    cj wrote:[color=blue]
    >
    > Dear friends, I have one more questions for everyone in the newsgroup:
    >
    > I am preparing for an interview on UNIX/C++. Could you please identify some
    > of the most important questions which might be asked, so that I could best
    > prepare for it?
    >[/color]


    ?????
    Puzzled. You aks for help on data structures and 8-queens and are
    going to an interview ????


    --
    Karl Heinz Buchegger
    kbuchegg@gascad .at

    Comment

    • Rufus V. Smith

      #3
      Re: Interview questions


      "cj" <cj@yahoo.com > wrote in message
      news:fd40f2b20f bab79c0fa397528 e1dd662@news.te ranews.com...[color=blue]
      > Dear friends, I have one more questions for everyone in the newsgroup:
      >
      > I am preparing for an interview on UNIX/C++. Could you please identify[/color]
      some[color=blue]
      > of the most important questions which might be asked, so that I could best
      > prepare for it?
      >
      > Thank you,
      > C++J
      >[/color]

      Why are you being interviewed for a topic you know nothing about?

      Rufus


      Comment

      • cj

        #4
        Re: Interview questions

        Yes. And I was hoping that folks here would be more helpful rather than
        patronizing.
        People are at different levels of their knowledge and at different points in
        their lives...
        I don't see it embarrassing to ask for help. As I was told in college "there
        are no dumb questions"...
        Or was gravely I misinformed?..

        C++J

        "Karl Heinz Buchegger" <kbuchegg@gasca d.at> wrote in message
        news:40D6EBBA.5 DE9B707@gascad. at...[color=blue]
        > cj wrote:[color=green]
        > >
        > > Dear friends, I have one more questions for everyone in the newsgroup:
        > >
        > > I am preparing for an interview on UNIX/C++. Could you please identify[/color][/color]
        some[color=blue][color=green]
        > > of the most important questions which might be asked, so that I could[/color][/color]
        best[color=blue][color=green]
        > > prepare for it?
        > >[/color]
        >
        >
        > ?????
        > Puzzled. You aks for help on data structures and 8-queens and are
        > going to an interview ????
        >
        >
        > --
        > Karl Heinz Buchegger
        > kbuchegg@gascad .at[/color]


        Comment

        • cj

          #5
          Re: Interview questions

          I may or may not be interviewed for this topic, I am just trying to cover as
          much ground as possible.
          In this economy it's quite hard, as many of us may know.

          C++J

          "Rufus V. Smith" <nospam@nospam. com> wrote in message
          news:c7a965b3b5 632350bc457a327 c7d08b9@news.te ranews.com...[color=blue]
          >
          > "cj" <cj@yahoo.com > wrote in message
          > news:fd40f2b20f bab79c0fa397528 e1dd662@news.te ranews.com...[color=green]
          > > Dear friends, I have one more questions for everyone in the newsgroup:
          > >
          > > I am preparing for an interview on UNIX/C++. Could you please identify[/color]
          > some[color=green]
          > > of the most important questions which might be asked, so that I could[/color][/color]
          best[color=blue][color=green]
          > > prepare for it?
          > >
          > > Thank you,
          > > C++J
          > >[/color]
          >
          > Why are you being interviewed for a topic you know nothing about?
          >
          > Rufus
          >
          >[/color]


          Comment

          • Karl Heinz Buchegger

            #6
            Re: Interview questions

            cj wrote:[color=blue]
            >
            > Yes. And I was hoping that folks here would be more helpful rather than
            > patronizing.
            > People are at different levels of their knowledge and at different points in
            > their lives...
            > I don't see it embarrassing to ask for help. As I was told in college "there
            > are no dumb questions"...
            > Or was gravely I misinformed?..[/color]

            No.

            But your problem seems to be equivalent to:
            'What is the difference between all the tools in my toolchest.
            I need to know because I am going to an interview for a car-mechanic
            job'

            Data structures are fundamental in most programming languages. Not
            knowing the common ones disqualifies everybody immediatly for a
            programming job (in my eyes). I spent 2 semester at university to
            study various data structures and algorithms on them.
            8-queens per se is more of academic interest, but it is often used
            as an entry point in a whole class of recursive algorithms,
            known as 'backtracking'. Again: I would expect any serious C or C++
            programmer to have programmed it at least once in his studying or
            knows how to do it or knows how to find information on the web
            about it. There must be thousends of web sites out there dealing
            with 8-queens and it is soooo easy to find them (www.google.com).


            --
            Karl Heinz Buchegger
            kbuchegg@gascad .at

            Comment

            • cj

              #7
              Re: Interview questions

              Thank you, Karl.

              "Karl Heinz Buchegger" <kbuchegg@gasca d.at> wrote in message
              news:40D6EF2E.6 58DE411@gascad. at...[color=blue]
              > cj wrote:[color=green]
              > >
              > > Yes. And I was hoping that folks here would be more helpful rather than
              > > patronizing.
              > > People are at different levels of their knowledge and at different[/color][/color]
              points in[color=blue][color=green]
              > > their lives...
              > > I don't see it embarrassing to ask for help. As I was told in college[/color][/color]
              "there[color=blue][color=green]
              > > are no dumb questions"...
              > > Or was gravely I misinformed?..[/color]
              >
              > No.
              >
              > But your problem seems to be equivalent to:
              > 'What is the difference between all the tools in my toolchest.
              > I need to know because I am going to an interview for a car-mechanic
              > job'
              >
              > Data structures are fundamental in most programming languages. Not
              > knowing the common ones disqualifies everybody immediatly for a
              > programming job (in my eyes). I spent 2 semester at university to
              > study various data structures and algorithms on them.
              > 8-queens per se is more of academic interest, but it is often used
              > as an entry point in a whole class of recursive algorithms,
              > known as 'backtracking'. Again: I would expect any serious C or C++
              > programmer to have programmed it at least once in his studying or
              > knows how to do it or knows how to find information on the web
              > about it. There must be thousends of web sites out there dealing
              > with 8-queens and it is soooo easy to find them (www.google.com).
              >
              >
              > --
              > Karl Heinz Buchegger
              > kbuchegg@gascad .at[/color]


              Comment

              • Mike Wahler

                #8
                Re: Interview questions


                "cj" <cj@yahoo.com > wrote in message
                news:fd40f2b20f bab79c0fa397528 e1dd662@news.te ranews.com...[color=blue]
                > Dear friends, I have one more questions for everyone in the newsgroup:
                >
                > I am preparing for an interview on UNIX/C++. Could you please identify[/color]
                some[color=blue]
                > of the most important questions which might be asked, so that I could best
                > prepare for it?[/color]

                UNIX is not topical here, so I'll skip that.

                About C++, if you are able to do all or most of
                the exercises in college-level textbooks, you'll
                have a reasonable chance of giving intelligent
                answers to interview questions. And at least a
                bit of (general programming) knowledge and/or
                experience will help.

                In short:

                Get books. Study. Practice. Practice. Practice.

                You can post your code here (with a description of
                its purpose) and ask for guidance, advice, review,
                and assistance.


                Also Google is an excellent way to find study resources.

                -Mike


                Comment

                • Ioannis Vranos

                  #9
                  Re: Interview questions

                  cj wrote:[color=blue]
                  > Dear friends, I have one more questions for everyone in the newsgroup:
                  >
                  > I am preparing for an interview on UNIX/C++. Could you please identify some
                  > of the most important questions which might be asked, so that I could best
                  > prepare for it?
                  >
                  > Thank you,
                  > C++J[/color]



                  Here is one I would ask:


                  Is the following code guaranteed to be safe and portable?



                  #include <string>
                  #include <vector>
                  #include <cstddef>

                  int main()
                  {
                  using namespace std;

                  class A
                  {
                  vector<int>arra y;
                  string s;

                  public:
                  A():array(100){ }
                  }a;


                  unsigned char *p=reinterpret_ cast<unsigned char *>(&a);

                  unsigned char *v=new unsigned char[sizeof(a)];


                  for(size_t i=0; i<sizeof(a); ++i)
                  v[i]=p[i];
                  }






                  Regards,

                  Ioannis Vranos

                  Comment

                  • E. Robert Tisdale

                    #10
                    Re: Interview questions

                    Ioannis Vranos wrote:
                    [color=blue]
                    > Here is one I would ask:
                    >
                    > Is the following code guaranteed to be safe and portable?[/color]
                    [color=blue]
                    > cat main.cc[/color]
                    #include <string>
                    #include <vector>
                    #include <cstddef>

                    int main(int argc, char* argv[]) {
                    using namespace std;

                    class A {
                    private:
                    vector<int> array;
                    string s;

                    public:
                    A(void): array(100) { }
                    } a;


                    unsigned char* p = reinterpret_cas t<unsigned char *>(&a);

                    unsigned char* v = new unsigned char[sizeof(a)];


                    for(size_t i = 0; i < sizeof(a); ++i)
                    v[i] = p[i];

                    return 0;
                    }
                    [color=blue]
                    > g++ -Wall -ansi -pedantic -o main main.cc
                    > ./main
                    >[/color]

                    Why would you ask such a question?
                    What would you expect it to reveal?

                    There is *no* guarantee that any code will be safe and portable.
                    Your code appears to comply with the ANSI/ISO C++ standard.
                    It will port almost everywhere.
                    Your code has no outputs and no persistent effects
                    and is "safe" in that sense.

                    My first suspicion is that you don't really know what you are doing.
                    I would be reluctant to accept any offer of employment
                    that you might make.

                    Perhaps you were simply attempting to be "too clever".
                    That's a common mistake for both programmers and managers.

                    If you want to test an applicant's C++ skills,
                    ask them to write a simple C++ program
                    or ask them to submit examples of C++ programs that they have written.

                    Don't test for understanding of subtle features of the language
                    unless you really need a C++ language lawyer and,
                    if you hire a C++ language lawyers,
                    don't expect them to be very productive.
                    You *will* be disappointed.

                    Comment

                    • Ioannis Vranos

                      #11
                      Re: Interview questions

                      E. Robert Tisdale wrote:
                      [color=blue]
                      > Ioannis Vranos wrote:
                      >[color=green]
                      >> Here is one I would ask:
                      >>
                      >> Is the following code guaranteed to be safe and portable?[/color]
                      >
                      >[color=green]
                      > > cat main.cc[/color]
                      > #include <string>
                      > #include <vector>
                      > #include <cstddef>
                      >
                      > int main(int argc, char* argv[]) {
                      > using namespace std;
                      >
                      > class A {
                      > private:
                      > vector<int> array;
                      > string s;
                      >
                      > public:
                      > A(void): array(100) { }
                      > } a;
                      >
                      >
                      > unsigned char* p = reinterpret_cas t<unsigned char *>(&a);
                      >
                      > unsigned char* v = new unsigned char[sizeof(a)];
                      >
                      >
                      > for(size_t i = 0; i < sizeof(a); ++i)
                      > v[i] = p[i];
                      >
                      > return 0;
                      > }
                      >[color=green]
                      > > g++ -Wall -ansi -pedantic -o main main.cc
                      > > ./main
                      > >[/color]
                      >
                      > Why would you ask such a question?
                      > What would you expect it to reveal?[/color]


                      It would be one of the many, in an effort to determine the depth of ISO
                      C++ knowledge. That one would be of the difficult ones.


                      [color=blue]
                      >
                      > There is *no* guarantee that any code will be safe and portable.[/color]


                      There is, for 100% ISO C++ compliant compilers. Others have called you a
                      troll, but I have seen that you have actual C++ knowledge so let's try
                      to discuss seriously for once.


                      [color=blue]
                      > Your code appears to comply with the ANSI/ISO C++ standard.
                      > It will port almost everywhere.
                      > Your code has no outputs and no persistent effects
                      > and is "safe" in that sense.[/color]



                      That code could be a part of a bigger program running 24h/24h.




                      [color=blue]
                      >
                      > My first suspicion is that you don't really know what you are doing.
                      > I would be reluctant to accept any offer of employment
                      > that you might make.[/color]



                      You know, I have bought an anti-troll spray of a new brand.






                      Regards,

                      Ioannis Vranos

                      Comment

                      • JKop

                        #12
                        Re: Interview questions

                        E. Robert Tisdale posted:
                        [color=blue]
                        > Why would you ask such a question?
                        > What would you expect it to reveal?[/color]

                        I believe its intent was to bemuse.
                        [color=blue]
                        > There is *no* guarantee that any code will be safe and portable.[/color]

                        Ofcourse there's a guarantee that code will be safe and portable. That's
                        what the Standard it all about.
                        [color=blue]
                        > Your code appears to comply with the ANSI/ISO C++ standard.
                        > It will port almost everywhere.[/color]

                        It will compile, Yes. But according to the Standard, it contains undefined
                        behaviour. Crystal clear to me. It will *not* port.
                        [color=blue]
                        > Your code has no outputs and no persistent effects
                        > and is "safe" in that sense.[/color]


                        Wrong, it's very very dirty.

                        [color=blue]
                        > My first suspicion is that you don't really know what you are doing.[/color]


                        Wrong, he seems pretty proficient to me.

                        [color=blue]
                        > Perhaps you were simply attempting to be "too clever".
                        > That's a common mistake for both programmers and managers.[/color]

                        blah blah blah
                        [color=blue]
                        > If you want to test an applicant's C++ skills,
                        > ask them to write a simple C++ program
                        > or ask them to submit examples of C++ programs that they have written.[/color]

                        Very good.

                        But by trying to trick them you also see just how much of an understanding
                        they have. Consider hiring a car mechanic. Ask them the following question:
                        You should put deisel in a petrol car:
                        A) During winter, when the temperature is below zero
                        B) When the tank is more than half full

                        If they're an in-any-way-good mechanic, they'll spot the trick and shout,
                        "NEVER PUT DEISEL IN A PETROL CAR!"
                        [color=blue]
                        > Don't test for understanding of subtle features of the language
                        > unless you really need a C++ language lawyer and,
                        > if you hire a C++ language lawyers,
                        > don't expect them to be very productive.
                        > You *will* be disappointed.[/color]

                        Unless ofcourse you ofter them money.


                        -JKop

                        Comment

                        • E. Robert Tisdale

                          #13
                          Re: Interview questions

                          Ioannis Vranos wrote:
                          [color=blue]
                          > E. Robert Tisdale wrote:[color=green]
                          >>
                          >> There is *no* guarantee that any code will be safe and portable.[/color]
                          >
                          > There is, for 100% ISO C++ compliant compilers.[/color]

                          That's a lie.
                          No compiler developer offers such a guarantee.

                          Comment

                          • Vladimir Shishkovsky

                            #14
                            Re: Interview questions

                            A agree with Rufus!!!

                            Do not prepare, just sleep and next day give answers on an interview
                            quastions.

                            Valdemar.


                            "Rufus V. Smith" <nospam@nospam. com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
                            news:c7a965b3b5 632350bc457a327 c7d08b9@news.te ranews.com...[color=blue]
                            >
                            > "cj" <cj@yahoo.com > wrote in message
                            > news:fd40f2b20f bab79c0fa397528 e1dd662@news.te ranews.com...[color=green]
                            > > Dear friends, I have one more questions for everyone in the newsgroup:
                            > >
                            > > I am preparing for an interview on UNIX/C++. Could you please identify[/color]
                            > some[color=green]
                            > > of the most important questions which might be asked, so that I could[/color][/color]
                            best[color=blue][color=green]
                            > > prepare for it?
                            > >
                            > > Thank you,
                            > > C++J
                            > >[/color]
                            >
                            > Why are you being interviewed for a topic you know nothing about?
                            >
                            > Rufus
                            >
                            >[/color]


                            Comment

                            • Ioannis Vranos

                              #15
                              Re: Interview questions

                              JKop wrote:

                              [color=blue]
                              > It will compile, Yes. But according to the Standard, it contains undefined
                              > behaviour. Crystal clear to me. It will *not* port.[/color]


                              Ehehe, I think I must give the answer. Yes it *is* portable. The
                              standard guarantees that you can treat any object as an array of
                              unsigned chars of size the result of sizeof() of course (=bytes).


                              So you can cout the internals of any object! :-)


                              Also for POD types (which can also be considered as plain char arrays)
                              it is guaranteed that if you copy them to a char, unsigned char array
                              you are getting valid objects exact copies of the original.


                              Consider the following code:


                              #include <iostream>
                              #include <cstddef>



                              int main()
                              {
                              using namespace std;

                              struct test
                              {
                              int x[10];

                              float y[10];
                              }x={ {0,1,2,3,4,5,6, 7,8,9}, {0,1.1,2.2,3.3, 4.4,5.5,6.6,7.7 ,8.8,9.9} };


                              unsigned char *y=new unsigned char[sizeof(x)];

                              unsigned char *xp=reinterpret _cast<unsigned char *>(&x);

                              for(size_t i=0; i<sizeof(x); ++i)
                              y[i]=xp[i];


                              test &r=reinterpret_ cast<test &>(*y);


                              cout<<"r.x[]= ";
                              for(size_t i=0; i<10; ++i)
                              cout<<r.x[i]<<" ";

                              cout<<"\nr.y[]";
                              for(size_t i=0; i<10; ++i)
                              cout<<r.y[i]<<" ";

                              cout<<endl;
                              }



                              Isn't C++ cool?






                              Regards,

                              Ioannis Vranos

                              Comment

                              Working...