MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following data structures are mutable?
A
Array
B
List
C
Tuple
D
Enum
Explanation: 

Detailed explanation-1: -Python has three mutable data structures: lists, dictionaries, and sets. Immutable data structures, on the other hand, are those that we cannot modify after their creation. The only basic built-in immutable data structure in Python is a tuple.

Detailed explanation-2: -Mutable data refers to a database structure in which data can be changed. Any data changes made simply overwrite and replace the previous record. This means that previous iterations of data are lost unless there is a system of back-ups and transaction logs that track changes.

Detailed explanation-3: -The list is a data type that is mutable. Once a list has been created: Elements can be modified. Individual values can be replaced.

Detailed explanation-4: -Unlike strings, lists are mutable. This means we can change an item in a list by accessing it directly as part of the assignment statement. Using the indexing operator (square brackets) on the left side of an assignment, we can update one of the list items.

Detailed explanation-5: -A list refers to a data structure in Python that is an ordered sequence of elements and it is mutable in nature. Furthermore, Python mutable lists may involve various data types like objects, integers and strings. Moreover, the lists, due to their mutable nature, can be altered after their creation.

There is 1 question to complete.