FC0-U61 · Question #469
Which of the following should be used to store a list of strings?
The correct answer is A. Array. An array is the most suitable data structure for storing a list of strings, as it allows a collection of elements of the same data type to be organized and accessed under a single variable name. Each string within the list can be individually referenced by an index.
Question
Which of the following should be used to store a list of strings?
Options
- AArray
- BConstant
- CVariable
- DBranch
How the community answered
(27 responses)- A89% (24)
- B4% (1)
- C7% (2)
Why each option
An array is the most suitable data structure for storing a list of strings, as it allows a collection of elements of the same data type to be organized and accessed under a single variable name. Each string within the list can be individually referenced by an index.
An array is a data structure that can store a fixed-size or dynamic-size collection of elements of the same data type, making it ideal for holding a list of strings. Each string in the list can be accessed individually using an index, providing an organized way to manage multiple related pieces of data.
A constant is a named storage location whose value cannot be changed during program execution, making it unsuitable for storing a dynamic list of strings.
A variable is a named storage location that holds a single value that can change during program execution; while it can hold one string, it cannot inherently hold a list of multiple strings without being specifically an array or list type.
A branch (or conditional statement) is a programming construct that executes different code blocks based on a condition, not a data structure used for storing data.
Concept tested: Data structures - arrays
Source: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays
Topics
Community Discussion
No community discussion yet for this question.