Objects and Classes Questions and Answers updated daily – C++



17 Objects and Classes Questions and answers section with explanation for various online exam preparation, various interviews, C++ Objects and Classes online test. Objects and Classes Questions with detailed description, explanation will help you to master the topic.

Objects and Classes Questions

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



SHOW ANSWER
Correct Ans:Composition
Explanation:


2. Which of the following can be overloaded?



SHOW ANSWER
Correct Ans:Both B and C
Explanation:


3. Which of the following statements is correct?



SHOW ANSWER
Correct Ans:Both data and functions can be either private or public.
Explanation:


4. How many objects can be created from an abstract class



SHOW ANSWER
Correct Ans:Zero
Explanation:


5. Constructor is executed when _____.



SHOW ANSWER
Correct Ans:an object is created
Explanation:


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



SHOW ANSWER
Correct Ans:Object
Explanation:


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



SHOW ANSWER
Correct Ans:Static
Explanation:


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



SHOW ANSWER
Correct Ans:Protected
Explanation:


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



SHOW ANSWER
Correct Ans:A class may be declared as a friend.
Explanation:


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



SHOW ANSWER
Correct Ans:Private
Explanation:


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



SHOW ANSWER
Correct Ans:Constructors can take arguments but destructors cannot.
Explanation:


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



SHOW ANSWER
Correct Ans:Public members of the base class become public members of derived class.
Explanation:


13. How can we make a class abstract?



SHOW ANSWER
Correct Ans:By making at least one member function as pure virtual function.
Explanation:


14. Which of the following two entities (reading from Left to Right) can be connected by the dot operator?



SHOW ANSWER
Correct Ans:A class object and a member of that class.
Explanation:


15. Which of the following statement is correct regarding destructor of base class?



SHOW ANSWER
Correct Ans:Destructor of base class should always be virtual.
Explanation:


16. Which of the following statements is incorrect?



SHOW ANSWER
Correct Ans:Friend keyword can be used on main().
Explanation:


17.
What happens when we try to compile the class definition in following code snippet?

class Birds {};
class Peacock : protected Birds {};



SHOW ANSWER
Correct Ans:It will compile succesfully.
Explanation:



FreshersLive - No.1 Job site in India. Here you can find latest 2017 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.