Attribute
Behavior
Instance
Method
Answer is Right!
Answer is Wrong!
The correct answer is B. Behavior.
An object’s behavior is the set of actions that it can perform. These actions are defined by the object’s methods. Methods are functions that are associated with an object and can be called on that object.
For example, a Car
object might have methods such as drive()
, brake()
, and turn()
. These methods allow the Car
object to perform the actions of driving, braking, and turning.
The other options are incorrect because:
- A. Attribute is a property of an object. For example, a
Car
object might have attributes such ascolor
,make
, andmodel
. - C. Instance is an object that is created from a class. For example, if
Car
is a class, then aCar
object is an instance of theCar
class. - D. Method is a function that is associated with an object. For example, a
Car
object might have methods such asdrive()
,brake()
, andturn()
.