Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 4 MCQs Operator Overloading, Type Conversion and Inheritance

CSE202 — Object Oriented Programming 50 questions. Pick an option to check it.

Read the notes

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    Which keyword is used to overload an operator in C++?

  2. Question 2 of 50

    Which of the following operators CANNOT be overloaded?

  3. Question 3 of 50

    When overloading a binary operator as a member function, how many arguments does the function take?

  4. Question 4 of 50

    When overloading a unary operator as a friend function, how many arguments must it take?

  5. Question 5 of 50

    To convert a Basic type to a Class type, which method is primarily used?

  6. Question 6 of 50

    Which syntax is used to define a conversion function to convert a Class type to a Basic type?

  7. Question 7 of 50

    What is the return type specified in the declaration of a casting operator function (e.g., operator int())?

  8. Question 8 of 50

    Which relationship does Inheritance primarily model?

  9. Question 9 of 50

    In the syntax class Derived : access Base, what is the default access mode if none is specified?

  10. Question 10 of 50

    Which type of inheritance involves a derived class inheriting from multiple base classes?

  11. Question 11 of 50

    In public inheritance, public members of the base class become __ in the derived class.

  12. Question 12 of 50

    In private inheritance, public members of the base class become __ in the derived class.

  13. Question 13 of 50

    Which members of a base class are never accessible to the derived class directly?

  14. Question 14 of 50

    What is the correct order of constructor execution in Single Inheritance?

  15. Question 15 of 50

    What is the correct order of destructor execution in Single Inheritance?

  16. Question 16 of 50

    If class C inherits from class B, and class B inherits from class A, this is an example of:

  17. Question 17 of 50

    What is the 'Diamond Problem' in C++ inheritance?

  18. Question 18 of 50

    How is the Diamond Problem resolved in C++?

  19. Question 19 of 50

    What distinguishes Function Overriding from Function Overloading?

  20. Question 20 of 50

    How can a derived class call an overridden member function of the base class?

  21. Question 21 of 50

    What does the protected access specifier ensure?

  22. Question 22 of 50

    Which concept represents a 'Has-A' relationship where the child cannot exist without the parent (Strong Association)?

  23. Question 23 of 50

    Which concept represents a 'Has-A' relationship where the child can exist independently of the parent (Weak Association)?

  24. Question 24 of 50

    When overloading the increment operator operator++(int), what does the dummy int parameter indicate?

  25. Question 25 of 50

    If class D : public B1, public B2 is defined, which constructor is called first?

  26. Question 26 of 50

    Which operator is typically overloaded to implement input/output for a user-defined class?

  27. Question 27 of 50

    Why must operator<< and operator>> be overloaded as friend functions usually?

  28. Question 28 of 50

    Can a constructor be inherited?

  29. Question 29 of 50

    What happens if a derived class defines a function with the same name as a base class function but different arguments?

  30. Question 30 of 50

    Which inheritance mode makes public members of the base class protected in the derived class?

  31. Question 31 of 50

    In hierarchical inheritance, how many derived classes exist?

  32. Question 32 of 50

    How do you pass arguments to a base class constructor from a derived class constructor?

  33. Question 33 of 50

    To prevent a class from being inherited, C++11 introduced which keyword?

  34. Question 34 of 50

    What is the return type of the overloaded assignment operator (operator=) generally?

  35. Question 35 of 50

    Which operator cannot be overloaded using a friend function?

  36. Question 36 of 50

    If a base class has a private member int x, and class D : public Base, how can D access x?

  37. Question 37 of 50

    What is the ambiguity resolution operator used in multiple inheritance?

  38. Question 38 of 50

    In composition, if the container object is destroyed:

  39. Question 39 of 50

    Which of the following is true about friend functions and inheritance?

  40. Question 40 of 50

    When overloading the subscript operator [], what is it commonly used for?

  41. Question 41 of 50

    What is a major advantage of Operator Overloading?

  42. Question 42 of 50

    If a constructor is declared explicit, what does it prevent?

  43. Question 43 of 50

    In a class-to-basic type conversion function, can arguments be passed?

  44. Question 44 of 50

    Virtual Base Classes are primarily used to solve ambiguity in which type of inheritance?

  45. Question 45 of 50

    Which header file is generally required for standard I/O operator overloading?

  46. Question 46 of 50

    What is the syntax to declare a virtual base class?

  47. Question 47 of 50

    In aggregation, the relationship between the Whole and the Part is:

  48. Question 48 of 50

    What is the main benefit of Inheritance?

  49. Question 49 of 50

    When overloading the function call operator (), how many arguments can it accept?

  50. Question 50 of 50

    If a class Derived inherits Protectedly from Base, and Base has a public function foo(), can main() call DerivedObj.foo()?

That's unit 4

Answer a few questions and your score shows up here.