cpp-programming-objects-and-classes Related Question Answers

1. Which of the following statements is correct when a class is inherited publicly?





2. Which of the following statements is correct about the constructors and destructors?





3. Which of the following access specifies is used in a class definition by default?





4. Which of the following statement is correct with respect to the use of friend keyword inside a class?





5. Which of the following keywords is used to control access to a class member?





6. Which of the following can access private data members or member functions of a class?





7. Which of the following type of data member can be shared by all instances of its class?





8. Which of the following also known as an instance of a class?





9. Constructor is executed when _____.





10. Which of the following statements about virtual base classes is correct?





11. How many objects can be created from an abstract class?





12. What does the class definitions in following code represent? class Bike { Engine objEng; }; class Engine { float CC; };





13. Which of the following statements is correct when a class is inherited privately?





14. What does a class hierarchy depict?





15. Which of the following can be overloaded?





16. Which of the following means "The use of an object of one class in definition of another class"?





17. Which of the following is the only technical difference between structures and classes in C++?





18. Which of the following statements is correct about the program given below? class Bix { public: static void MyFunction(); }; int main() { void(ptr)() = &Bix::MyFunction; return 0; }





19. Which of the following statements are correct for a static member function? It can access only other static members of its class. It can be called using the class name, instead of objects.





20. What will be the output of the following program? #include<iostream.h> class Bix { public: int x; }; int main() { Bix p = new Bix(); (p).x = 10; cout<< (p).x << " " << p->x << " " ; p->x = 20; cout<< (p).x << " " << p->x ; return 0; }





21. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { static int x; public: static void SetData(int xx) { x = xx; } void Display() { cout<< x ; } }; int IndiaBix::x = 0; int main() { IndiaBix::SetData(33); IndiaBix::Display(); return 0; }





22. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { static int x; public: static void SetData(int xx) { x = xx; } static void Display() { cout<< x ; } }; int IndiaBix::x = 0; int main() { IndiaBix::SetData(44); IndiaBix::Display(); return 0; }





23. What will be the output of the following program? #include<iostream.h> class BixTeam { int x, y; public: BixTeam(int xx) { x = ++xx; } void Display() { cout<< --x << " "; } }; int main() { BixTeam objBT(45); objBT.Display(); int p = (int)&objBT; p = 23; objBT.Display(); return 0; }





24. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { static int x; public: static void SetData(int xx) { this->x = xx; } static void Display() { cout<< x ; } }; int IndiaBix::x = 0; int main() { IndiaBix::SetData(22); IndiaBix::Display(); return 0; }





25. What will be the output of the following program? #include<iostream.h> class India { public: struct Bix { int x; float y; void Function(void) { y = x = (x = 44); y = --y y; } void Display() { cout<< y << endl; } }B; }I; int main() { I.B.Display(); return 0; }





Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution