The document contains a quiz with multiple choice questions about object-oriented programming concepts in C++. It tests knowledge of key ideas like encapsulation, inheritance, polymorphism, and classes. Questions cover class members, constructors, destructors, and the differences between classes and structs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
24 views
Ungraded Quiz Solution
The document contains a quiz with multiple choice questions about object-oriented programming concepts in C++. It tests knowledge of key ideas like encapsulation, inheritance, polymorphism, and classes. Questions cover class members, constructors, destructors, and the differences between classes and structs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Student ID:______________
1. In a class definition, data or functions designated private are accessible
a) to any function in the program. c) to member functions of that class. b) only if you know the password d) only to public members of the class. 2. Classes are useful because they a) are removed from memory when not in use. c) bring together all aspects of an entity b) permit data to be hidden from other classes. d) can closely model objects in the real world 3. paying attention to the important properties while ignoring unessential details is known as a) abstraction c) polymorphism b) selectiveness d) summarizing 4. A technique that programmers use to provide object encapsulation is to usually make objects’ data _____ a) private c) polymorphic b) accessible d) static 5. the feature of OOP that allows same operation to be carried out differently, depending on the object, is a) encapsulation c) inheritance b) pointer creation d) polymorphism 6. A ___________ is called automatically each time an object is create a) compiler c) builder b) constructor d) destructor 7. the most common use of constructors is to a) initialize data fields c) call mutator functions b) perform mathematical calculations d) deallocate memory 8. Which of the following is not the member of class? a) Static function c) Const function b) Friend function d) Virtual function 9. when an object goes out of scope, a(n) ___________ is called automatically. a) destructor c) overloaded function b) constructor d) operating system error message 10. What is the difference between a struct and a class in C++? a) A struct cannot have member functions. c) A class has a default privacy specification of private. b) A class has a default privacy specification of public d) A struct cannot have private members. 11. Which of the following is not a type of constructor? a) Copy constructor c) Default constructor b) Friend constructor d) Parameterized constructor 12. cout is a/an __________ . a) operator c) object b) function d) macro 13. Which of the following concepts provides facility of using object of one class inside another class? a) Encapsulation c) Composition b) Abstraction d) Inheritance 14. Which of the following concepts means wrapping up of data and functions together? a) Abstraction c) Inheritance b) Encapsulation d) Polymorphism 15. Which of the following is not a feature of OOP in C++ a) Encapsulation c) Abstraction b) Exceptions d) Polymorphism 16. The destructor function return type is a) Null c) Pointer b) Object d) Zero 17. When a member function is defined outside class declaration, the member function can be defined using _______ operator a) : ? c) >> b) :: d) << 18. Which member function cannot change object’s data members a) Static c) Private b) Inline d) Const 19. The process of declaring member function in derived class with same name and same signature is called a) Function overload c) Member function b) Function overriding d) Friend function 20. Which of the following is primitive data type a) Double b) Stack c) Class d) structure