Question: Subject: Object Oriented Programming. Question No. 1: MCQs. Write correct option (A, B, or C ) against each question or give a Short Answer on

Subject: Object Oriented Programming. Question No. 1: MCQs. Write correct option (A, B, or C ) against each question or give a Short Answer on answer sheet. CLO 1 20 Marks 1. Operator overloading is a. giving C++ operators more than they can handle. b. giving new meanings to existing C++ operators. c. making new C++ operators.

2. How many arguments are required in the definition of an overloaded unary operator? ________________________

3. Assuming that class X does not use any overloaded operators, write a statement that adds an object of class X, x1, to another such object, x2, and places the result in x3. ___________________

4. Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 - obj2; to work correctly, the overloaded - operator must a. take two arguments. b. return a value. c. create a named temporary object.

5. To convert from a user-defined class to a basic type, you would most likely use a. a built-in conversion operator. b. a one-argument constructor. c. a conversion operator thats a member of the class.

6. True or False: The statement objA = objB; will cause a compiler error if the objects are of different classes. __ ________________ _____

7. To convert from a basic type to a user-defined class, you would most likely use a. a built-in conversion operator. b. a one-argument constructor. c. a conversion operator thats a member of the class.

8. Inheritance is a way to a. Pass arguments to objects of classes. b. Add features to existing classes without rewriting them. c. Improve data hiding and encapsulation.

9. If a base class and a derived class each include a member function with the same name, which member function will be called by an object of the derived class, assuming the scope-resolution operator is not used? _ _____________ _____________

10. Assume that there is a class Derv that is derived from a base class Base. Write the declarator for a derived-class constructor that takes one argument and passes this argument along to the constructor in the Base class. ____________________________

11. Assume a class Derv that is privately derived from class Base. An object of class Derv located in main( ) can access a. private members of Derv. b. protected members of Derv. c. public members of Derv.

12. A class hierarchy a. describes has a relationships. b. describes is a kind of relationships. c. shows the same relationships as a family tree.

13. Aggregation is a. a stronger form of generalization. b. a stronger form of composition. c. a has a relationship.

14. Virtual functions allow you to a. use the same function call to execute member functions of objects from different classes. b. create an array of type pointer-to-base class that can hold pointers to derived classes. c. group objects of different classes so they can all be accessed by the same function code.

15. True or false: A pointer to a base class can point to objects of a derived class 16. If there is a pointer, p, to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a virtual member function, ding(), the statement p->ding(); will cause the version of ding() in the ________ class to be executed. 17. If there is a pointer p to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a nonvirtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the ________ class to be executed.

18. A pure virtual function is a virtual function that a. returns nothing. b. is used in a derived class. c. causes its class to be abstract.

19. A pointer is a. a variable for storing addresses. b. the address of a variable. c. an indication of the variable to be accessed next.

20. What is Late Binding?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!