A developer examines a workflow in which filenames are stored within a collection. The collection is initialized with a single filename. When adding a new filename to the collection, which collection variable type will cause an error?
A developer examines a workflow in which filenames are stored within a collection. The collection is initialized with a single filename. When adding a new filename to the collection, which collection variable type will cause an error?
An array has a fixed size once it is initialized, meaning you cannot add new elements to it without creating a new array. This fixed size nature of arrays makes them unsuitable for scenarios where the collection needs to be dynamically expanded, such as adding new filenames. Therefore, attempting to add a new filename to an array will cause an error.
Array has a fixed size after initialization
System.Array: An array is a fixed-size collection that can hold elements of the same data type. It’s not ideal for scenario because you want to add new filenames dynamically.
B seems to be the more accurate answer
B seems to be the more accurate answer. Once an array is initialized, it is fixed, meaning it cannot grow in size. A list is a data collection that works similar to an array, HOWEVER, a list can add new items and constantly grow in size.
Based on your explanation then C is the correct answer because the question is asking which will cause an error. An array will, because it is fixed.