C++ Interview questions and answers

Some good C++ questions to ask a job applicant.

  1. How do you decide which integer type to use?
  2. What should the 64-bit integer type on new, 64-bit machines be?

  3. What’s the best way to declare and define global variables?
  4. What does extern mean in a function declaration?
  5. What’s the auto keyword good for?
  6. I can’t seem to define a linked list node which contains a pointer to itself.
  7. How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
  8. How can I declare a function that returns a pointer to a function of its own type?
  9. My compiler is complaining about an invalid redeclaration of a function, but I only define it once and call it once. What’s happening?
  10. What can I safely assume about the initial values of variables which are not explicitly initialized?
  11. Why can’t I initialize a local array with a string?
  12. What is the difference between char a[] = “string”; and char *p = “string”; ?
  13. How do I initialize a pointer to a function?
This entry was posted in C++. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

51 Comments on C++ Interview questions and answers

  1. jaz
    Posted 12/1/2008 at 1:50 am | Permalink

    pointer to function same as that of pointer to Data, pointer to must have a prototype of a function which pointer pointing to.

Post a Comment

Your email is never published nor shared. Required fields are marked *