Here is couple of questions from the 3rd C++ test at careerride.com.
It looks like the guy, made the test was bit up in smoke?
Or I don't understand somethnig... Need your judgement..
1)5.Class1& test(Class1 obj)
{
Class1 *ptr = new Class1();
.........
return ptr;
}
You answered: reference of Class1
Incorrect
Correct answer: reference to ptr
Correct answer: compile error!!!! - comment by S.d.
2)12. Which of the following members do get inherited but become private members in child class
Choices: public, protected, private, all
You answered: All the above
Incorrect
Correct answer: Protected
- this one is completely crazy. I cannot realize even how to modify the question (to guess author's implication), so it will be "protected".
The only way - if we change "private" to "inaccessible" - answer will be "private". But not f***ing protected!
3)16. If a member needs to have unique value for all the objects of that same class, declare the member as
You answered: Dynamic variable inside class
Incorrect
Correct answer: Local variable inside constructor
- here both answers are not corrrect - "Local ..." won't exist after a class is constructed, but "dynamic variable" is close to "non-static variable" which should be correct.. if somebody will care of making it unique...
1)I agree, compile error
2)The answer to this question depends on the type of inheritance, I looked at the question it doesn't specify, how could you answer, It could be ALL as you answered.
3)
declare the member as
and answer
Local variable inside constructor
... uhhh no, how is a local variable a member of the class... buggy test.