Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Interview Question

Interview Question

Scheduled Pinned Locked Moved The Lounge
csharpc++questioncareer
17 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Christian Graus

    The MSDN STL docs are *pathetic*. If you're in a hurry, the docs online at sgi are good, they form the basis of the Generic Programming and the STL book from Addison Wesley. Their 'STL Tutorial and Reference' is also a great book. I recently got a new job, and the interview was easier than I thought it would be. They asked me about stuff like why use OO, what was inheritance, what was private/protected/public, etc. I expected STL questions, didn't get any. No questions on the standard library at all, just really rudimentary C++. There were also ATL questions, which I don't know that well, and my advice is always be brutally honest about stuff you don't know. christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff. Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.

    Sonork ID 100.10002:MeanManOz

    I live in Bob's HungOut now

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #5

    When are we getting together for lunch or coffee? Michael Martin Australia mmartin@netspace.net.au "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

    C 1 Reply Last reply
    0
    • L Lost User

      When are we getting together for lunch or coffee? Michael Martin Australia mmartin@netspace.net.au "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #6

      When it stops raining :-) I was thinking we could meet in town on Friday ? Maybe outside the offices of your old work, and we could either go for a rampage with Nerf guns, or just throw some bricks, last person to break a window buys the coffee.... Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.

      L 1 Reply Last reply
      0
      • L Lost User

        After 4 months of unemployment I finally got an interview! w00tw00t As part of the interview process I've got to take a c++ test. I'm pretty confident of my abilities so I'm not too worried. It's supposed to cover just c++ so I shouldn't have to worry about any other libraries or APIs. I'm wondering if anyone could give me some examples of what they'd expect to find or put on a test of this nature. Or any suggestions for topics to brush up on. Thanks, Josh Knox that-guy.net
        "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

        S Offline
        S Offline
        Stuart van Weele
        wrote on last edited by
        #7

        Here are a few: What's the difference between a struct and a class? What happens if you don't define a constructor? What's a copy constructor? What happens if you don't define it? What's the difference between private and protected? Write a generic stack class using templates. What's a thunk? Explain exceptions and how they are used to write robust code. What's RTTI? How does MFC do this instead? Explain how you would write a generic string sorting routine using templates. How would you do it using function pointers? What's name mangling? Why do C++ compilers do it? Describe the various cast operators and where they are used.

        C 1 Reply Last reply
        0
        • L Lost User

          After 4 months of unemployment I finally got an interview! w00tw00t As part of the interview process I've got to take a c++ test. I'm pretty confident of my abilities so I'm not too worried. It's supposed to cover just c++ so I shouldn't have to worry about any other libraries or APIs. I'm wondering if anyone could give me some examples of what they'd expect to find or put on a test of this nature. Or any suggestions for topics to brush up on. Thanks, Josh Knox that-guy.net
          "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

          R Offline
          R Offline
          Rick York
          wrote on last edited by
          #8

          Here are a couple of pages of questions at DDJ that could be helpful to brush up on : Page 1 Page 2 Good Luck. My jokes page

          1 Reply Last reply
          0
          • C Christian Graus

            When it stops raining :-) I was thinking we could meet in town on Friday ? Maybe outside the offices of your old work, and we could either go for a rampage with Nerf guns, or just throw some bricks, last person to break a window buys the coffee.... Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #9

            ****Christian Graus wrote: ...or just throw some bricks, last person to break a window buys the coffee.... Sounds good to me. Set the time closer to the day. Michael Martin Australia mmartin@netspace.net.au "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

            1 Reply Last reply
            0
            • S Stuart van Weele

              Here are a few: What's the difference between a struct and a class? What happens if you don't define a constructor? What's a copy constructor? What happens if you don't define it? What's the difference between private and protected? Write a generic stack class using templates. What's a thunk? Explain exceptions and how they are used to write robust code. What's RTTI? How does MFC do this instead? Explain how you would write a generic string sorting routine using templates. How would you do it using function pointers? What's name mangling? Why do C++ compilers do it? Describe the various cast operators and where they are used.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #10

              Stuart van Weele wrote: What's the difference between a struct and a class? A structs members are public by default, a class's are private. Stuart van Weele wrote: What happens if you don't define a constructor? C++ generates one for you, which will only do a shallow copy of pointers. Stuart van Weele wrote: What's a copy constructor? What happens if you don't define it? A constructor that takes an item of the same type as it's argument and makes the new object a copy of it. If you don't define it, you cannot do this: MyType newItem(ObjectOfMyType); Stuart van Weele wrote: What's the difference between private and protected? Protected items are visible to classes derived from the class in question. Stuart van Weele wrote: Write a generic stack class using templates. Can I skip this one for time ? :-) Stuart van Weele wrote: What's a thunk? Dunno. Stuart van Weele wrote: Explain exceptions and how they are used to write robust code. Exceptions allow me to 'try' to execute code that may fail, and catch the case were it does fail in a way that allows me to clean up after myself, try again if appropriate, and of course, not die in a flaming heap. Stuart van Weele wrote: What's RTTI? How does MFC do this instead? Run Time Type Identification allows me to find out if an object of a base class is of a specific derived class, using dynamic_cast. The cast returns 0 (NULL) if the cast is not appropriate. MFC does this badly. It uses a macro called RUNTIME_CLASS, and from memory, the DECLARE_XXX macro creates an object of some MFC type which is used to facilitate this. I really don't know for sure, because I hate it, and it only exists because MFC is older than X3J16. Stuart van Weele wrote: Explain how you would write a generic string sorting routine using templates. How would you do it using function pointers? Can I skip this one too ? Actually, I'm going to think about this, it's not quite as easy as the templated stack question was. Stuart van Weele wrote: What's name mangling? Why do C++ compilers do it? Name mangling is done by compilers, I believe, in order to give overloaded functions differing names. Stuart van Weele wrote: D

              S V 2 Replies Last reply
              0
              • L Lost User

                After 4 months of unemployment I finally got an interview! w00tw00t As part of the interview process I've got to take a c++ test. I'm pretty confident of my abilities so I'm not too worried. It's supposed to cover just c++ so I shouldn't have to worry about any other libraries or APIs. I'm wondering if anyone could give me some examples of what they'd expect to find or put on a test of this nature. Or any suggestions for topics to brush up on. Thanks, Josh Knox that-guy.net
                "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #11

                All the C++ questions I've had to field have been cake, designed to make sure you're were BSing on your resume. The more important part is when the interviewer asks what you did on a project at a previous job. That's where you show off that you know how to practically apply C++ techniques, and that you know more than just the buzzwords. --Mike-- "Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."   -- Daniel Ferguson, 1/31/2002 My really out-of-date homepage Sonork - 100.10414 AcidHelm Big fan of Alyson Hannigan.

                1 Reply Last reply
                0
                • C Christian Graus

                  Stuart van Weele wrote: What's the difference between a struct and a class? A structs members are public by default, a class's are private. Stuart van Weele wrote: What happens if you don't define a constructor? C++ generates one for you, which will only do a shallow copy of pointers. Stuart van Weele wrote: What's a copy constructor? What happens if you don't define it? A constructor that takes an item of the same type as it's argument and makes the new object a copy of it. If you don't define it, you cannot do this: MyType newItem(ObjectOfMyType); Stuart van Weele wrote: What's the difference between private and protected? Protected items are visible to classes derived from the class in question. Stuart van Weele wrote: Write a generic stack class using templates. Can I skip this one for time ? :-) Stuart van Weele wrote: What's a thunk? Dunno. Stuart van Weele wrote: Explain exceptions and how they are used to write robust code. Exceptions allow me to 'try' to execute code that may fail, and catch the case were it does fail in a way that allows me to clean up after myself, try again if appropriate, and of course, not die in a flaming heap. Stuart van Weele wrote: What's RTTI? How does MFC do this instead? Run Time Type Identification allows me to find out if an object of a base class is of a specific derived class, using dynamic_cast. The cast returns 0 (NULL) if the cast is not appropriate. MFC does this badly. It uses a macro called RUNTIME_CLASS, and from memory, the DECLARE_XXX macro creates an object of some MFC type which is used to facilitate this. I really don't know for sure, because I hate it, and it only exists because MFC is older than X3J16. Stuart van Weele wrote: Explain how you would write a generic string sorting routine using templates. How would you do it using function pointers? Can I skip this one too ? Actually, I'm going to think about this, it's not quite as easy as the templated stack question was. Stuart van Weele wrote: What's name mangling? Why do C++ compilers do it? Name mangling is done by compilers, I believe, in order to give overloaded functions differing names. Stuart van Weele wrote: D

                  S Offline
                  S Offline
                  Stuart van Weele
                  wrote on last edited by
                  #12

                  I'm impressed. I would seriously consider hiring anyone who could answer more than 1/2 the questions off the top of their head. A thunk is an on the fly conversion from one type to another. Thunks are used to make 16 bit code work with 32 bit code or for other kluges. I think ATL has a thunk buried in it that allows a static WndProc to be associated with an instance of a ATL class. The template questions are out of Stroustrup. Actually most of these questions are out of Stroustrup.

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    Stuart van Weele wrote: What's the difference between a struct and a class? A structs members are public by default, a class's are private. Stuart van Weele wrote: What happens if you don't define a constructor? C++ generates one for you, which will only do a shallow copy of pointers. Stuart van Weele wrote: What's a copy constructor? What happens if you don't define it? A constructor that takes an item of the same type as it's argument and makes the new object a copy of it. If you don't define it, you cannot do this: MyType newItem(ObjectOfMyType); Stuart van Weele wrote: What's the difference between private and protected? Protected items are visible to classes derived from the class in question. Stuart van Weele wrote: Write a generic stack class using templates. Can I skip this one for time ? :-) Stuart van Weele wrote: What's a thunk? Dunno. Stuart van Weele wrote: Explain exceptions and how they are used to write robust code. Exceptions allow me to 'try' to execute code that may fail, and catch the case were it does fail in a way that allows me to clean up after myself, try again if appropriate, and of course, not die in a flaming heap. Stuart van Weele wrote: What's RTTI? How does MFC do this instead? Run Time Type Identification allows me to find out if an object of a base class is of a specific derived class, using dynamic_cast. The cast returns 0 (NULL) if the cast is not appropriate. MFC does this badly. It uses a macro called RUNTIME_CLASS, and from memory, the DECLARE_XXX macro creates an object of some MFC type which is used to facilitate this. I really don't know for sure, because I hate it, and it only exists because MFC is older than X3J16. Stuart van Weele wrote: Explain how you would write a generic string sorting routine using templates. How would you do it using function pointers? Can I skip this one too ? Actually, I'm going to think about this, it's not quite as easy as the templated stack question was. Stuart van Weele wrote: What's name mangling? Why do C++ compilers do it? Name mangling is done by compilers, I believe, in order to give overloaded functions differing names. Stuart van Weele wrote: D

                    V Offline
                    V Offline
                    Vimal Earnest
                    wrote on last edited by
                    #13

                    1.If we don't define a copy constructor the compiler will generate one for us and any pointer members will "bitwise" (shallow) copied. 2.A default constructor will do nothing.Nothing is copied.

                    C 1 Reply Last reply
                    0
                    • V Vimal Earnest

                      1.If we don't define a copy constructor the compiler will generate one for us and any pointer members will "bitwise" (shallow) copied. 2.A default constructor will do nothing.Nothing is copied.

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #14

                      Damn - when I read your post in my email, I thought 'is he correcting me, I know this', but reading my answer, I put them the wrong way around. Duh. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.

                      1 Reply Last reply
                      0
                      • L Lost User

                        Good suggestion. I've had little need to use STL much, so that's prob'ly my weak point. Any key topics I should be sure of? And what's a good STL reference other than MSDN? Their STL docs are scary. Josh Knox that-guy.net
                        "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #15

                        Hrm. It's kind of difficult to describe, and you *won't* get any help from MSDN. (At least the MSDN in VC6 - VS.NET's documentation is much better/more complete.) I'll suggeset a book once I get to work.. (Because I left it there, and can't remember the title/author/ISBN, lol.) Perhaps a simple sample of using std::map<>s as an associative array: ----- #include #include int main(int argc, char *argv[]) { std::map mapAgeName; map.insert(std::make_pair("Kristopher", 21)); map.insert(std::make_pair("Ashley", 19)); map.insert(std::make_pair("Jebidiah", 34)); map["Joeseph"] = 42; cout << "Ashley is " << mapAgeName["Ashley"]->second << "years old." << endl; } ------ Notes: 1. STL defines most of it's classes/functions/templates in the namespace 'std', so if you want to use them, just prefix each one with std:: (or add 'using namespace std' to the top of the program. 2. std::make_pair() makes a "pair" of items - not sure how to describe that. 3. You can access the first element of an item (of an associative array) using ->first; 4. I just woke up.. :laugh: -- .sig error: indeteriminent reader intelligence

                        1 Reply Last reply
                        0
                        • L Lost User

                          After 4 months of unemployment I finally got an interview! w00tw00t As part of the interview process I've got to take a c++ test. I'm pretty confident of my abilities so I'm not too worried. It's supposed to cover just c++ so I shouldn't have to worry about any other libraries or APIs. I'm wondering if anyone could give me some examples of what they'd expect to find or put on a test of this nature. Or any suggestions for topics to brush up on. Thanks, Josh Knox that-guy.net
                          "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

                          T Offline
                          T Offline
                          Todd C Wilson
                          wrote on last edited by
                          #16

                          Explain the differnces between a private, public, and protected constructor. Defened the usages of each of these. Explain when the FRIEND keyword should be used. Explain when FRIEND should not be used. Defend these positions. What is the difference between N++ and ++N? What warning level do you use? Why? Show an example of Templates that could not be done with macros. Do you comment your code? Where? How much? In what way? Do you use the "? :" operator? What does the comma do? Do you pass by reference or by copy? When should you return a const reference to a member variable? No, I'm not making these up. These are actual questions that *I* asked people wben *I've* interviewed them. Yes, I've had a few people go stark raving mad with them - because they are mostly not canned answers, but to get an idea how *they* work and if they know C++ or are just blowing smoke. You'd be surprised!


                          Si hoc Legere Scis Nimium Eruditionis Habes

                          1 Reply Last reply
                          0
                          • L Lost User

                            After 4 months of unemployment I finally got an interview! w00tw00t As part of the interview process I've got to take a c++ test. I'm pretty confident of my abilities so I'm not too worried. It's supposed to cover just c++ so I shouldn't have to worry about any other libraries or APIs. I'm wondering if anyone could give me some examples of what they'd expect to find or put on a test of this nature. Or any suggestions for topics to brush up on. Thanks, Josh Knox that-guy.net
                            "Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #17

                            The book is: "The C++ Standard Library" by Nicolai M. Josuttis ISBN: 0-201-37926-0 (Got it at Barnes & Noble, 49.95$) :-D -- .sig error: indeteriminent reader intelligence

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups