need help.. true/false

hello i had a exam today n i wana clear about the following 5 true/false

Code:

1) Virtual methods must be over-ridded by child class
2) An object of an abstract class can store reference of objects of all its child classes
3) Output of the statement {cout<<4+2*3+'A';} will be 75
4) Over-riddd methods must have same names but different signatures
5) Polymorphism is implemented through early binding of reference variable and object of class

4. False. They must have the same name and signature to over-ride, a different signature makes it over-loaded.

Originally Posted by http://www.objs.com/x3h7/cplus.htm

4. Polymorphism

C++ supports polymorphism by allowing member functions defined in classesto be overridden with member functions having the same names (operatoroverloading), but different implementations, in derived classes (subclasses).In selecting the appropriate member function to call in response to a functioninvocation, C++ distinguishes between the static type of a referenceand the dynamic type of the object it refers to at a given point. The dynamic type must be a descendant of the static type. The invocationis type-checked based on the static type of the reference. If the functioncalled is a virtual member function, the member function associated withthe actual object pointed to is called dynamically at run time. If thefunction is non-virtual, the call will have been statically bound to themember function of the reference's class at compile time.

well I did the first one true because its "PURE VIRTUAL" functionsssssss that must be over-ridded by child class ) not "VIRTUAL" virtual CAN be or CANNOT be.. there is no MUST.. thats why i marked first one as FALSE.. is my logic wrong or wht?

Your answer of true is probably the expected answer, but note that pedantically speaking cout does not necessarily have to refer to std::cout and the value of 'A' depends on the character set.

Originally Posted by salmansalman

5) Polymorphism is implemented through early binding of reference variable and object of class

I agree with Dino on this one. "Polymorphism" here probably means runtime (sub)type polymorphism, which is characterised by dynamic (late) binding of the "reference variable" and the actual object of the class or subclass instantiated at runtime. This means that the answer would be false.

Originally Posted by salmansalman

well I did the first one true because its "PURE VIRTUAL" functionsssssss that must be over-ridded by child class ) not "VIRTUAL" virtual CAN be or CANNOT be.. there is no MUST.. thats why i marked first one as FALSE.. is my logic wrong or wht?

Your logic sounds correct (though I presume that "I did the first one true" is a typographical error since you later say that you "marked first one as FALSE"). However, strictly speaking, it is not a must to override a pure virtual function since the derived class does not have to be a concrete class. Nonetheless, the answer would still be false.

Originally Posted by Bjarne Stroustrup (2000-10-14)

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.