- A Classes are real-world entities while objects are not real
- B Objects are real-world entities while classes are not real
- C Both objects and classes are real-world entities
- D All of the above
- Share this MCQ
Answer:
B
Share this MCQ
In object-oriented programming, an object is an instance of a class.
Objects are often used to represent real-world entities, but the class itself is just a blueprint or template for creating objects.
For example, you might have a class called Dog that represents dogs in general.
The Dog class could have attributes like breed, age, and name, and methods like bark() and fetch().
You could then create individual Dog objects to represent specific dogs,
such as a Dog object for your own dog named "Fido" that is a 4-year-old labrador.
Fido's Dog object would have the attribute values breed="labrador", age=4, and name="Fido".
Share this MCQ