A Simple C++ Quiz

posted in Washu's Journal
Published September 14, 2014
Advertisement
This is a very basic C++ quiz, it mainly tests a wee bit of knowldege that I've found some people who profess to have a mastery of C++ to be lacking. The answers should all be based on the C++ standard, and not your compiler's implementation.
Use the following code snippet to answer questions 1 through 3:int* p = new int[10];int* j = p + 11;int* k = p + 10;

  1. Is the second line well defined behavior?
  2. If the second line is well defined, where does the pointer j point to after the second line is executed.

  3. What are some of the legal operations that can be performed on the pointer k?

  4. What output should the following lines of code produce?int a = 10;std::cout<

  5. Assuming the function called in the following block of code has no default parameters, and that no operators are overloaded, how many parameters does it take? Which objects are passed to it?f((a, b, c), d, e, ((g, h), i));


Source
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement