41. What is a constructor in object-oriented programming?

  • A method that is used to destroy an object.
  • A method that is used to create an object.
  • A method that is used to modify an object.
  • Both B and C.

42. What is an abstract class in object-oriented programming?

  • A class that cannot be instantiated.
  • A class that can only be instantiated once.
  • A class that has no properties or methods.
  • Both A and C.

43. What is polymorphism in object-oriented programming?

  • The ability of an object to take on many forms.
  • The process of creating new objects.
  • The process of creating new classes from existing classes.
  • Both A and B.

44. What is method overloading in object-oriented programming?

  • The process of creating new methods from existing methods.
  • The process of creating new classes from existing classes.
  • The process of creating new objects from existing objects.
  • None of the above.

45. What is the purpose of an access modifier in object-oriented programming?

  • To determine the order in which methods are executed.
  • To control the visibility and accessibility of class members.
  • To define the behavior of an object.
  • To create a new object from an existing object.

46. What is the difference between a static method and an instance method in object-oriented programming?

  • There is no difference between a static method and an instance method.
  • A static method can be called on an object, while an instance method cannot.
  • An instance method can access non-static fields and methods of the class, while a static method cannot.
  • Both B and C.

Leave a Reply