COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
A mutable structure is one which can only have data added to it
|
|
A mutable structure is one which is fixed in size
|
|
A mutable structure is one which allows data to be added, edited, deleted or moved
|
|
None of the above
|
Detailed explanation-1: -Mutable data refers to a database structure in which data can be changed. Any data changes made simply overwrite and replace the previous record.
Detailed explanation-2: -A mutable value is one that can be changed without creating an entirely new value. In JavaScript, objects and arrays are mutable by default, but primitive values are not-once a primitive value is created, it cannot be changed, although the variable that holds it may be reassigned.
Detailed explanation-3: -A mutable object can be changed after it’s created, and an immutable object can’t. That said, if you’re defining your own class, you can make its objects immutable by making all fields final and private. Strings can be mutable or immutable depending on the language.
Detailed explanation-4: -If immutable objects are objects whose value can’t change once created, a mutable object is an object whose value can change once created. Mutable objects are often objects that can store a collection of data. Lists (Python type list ) and dictionaries (Python type dict ) are examples of mutable objects.
Detailed explanation-5: -Mutable is a fancy way of saying that the internal state of the object is changed/mutated. So, the simplest definition is: An object whose internal state can be changed is mutable. On the other hand, immutable doesn’t allow any change in the object once it has been created.