A variable should hold the names of all past U.S. presidents. Which data type should the variable be?

Prepare for the WGU EDUC5289 D017 School Law Test. Engage with flashcards and multiple-choice questions, each with hints and explanations. Get exam-ready now!

The appropriate choice for holding the names of all past U.S. presidents is a string array. A string array is ideal because it can store multiple strings, allowing you to keep each president's name in its own element. This organization is crucial when working with a list of names, as it allows for easy access and manipulation of each individual entry.

Utilizing a string array permits you to easily loop through the data to perform various operations, such as sorting, searching, or displaying the names collectively or individually. Given that there are many names to store, this structure efficiently manages multiple entries while maintaining clarity and ease of use in programming.

Other options like a single string or a character array would not be sufficient for this purpose. A single string could only hold one name and would not be able to store all past presidents collectively. Meanwhile, a character array would be more complex to manage, as it requires handling individual characters rather than whole words (the names). Therefore, a string array is the most suitable choice for storing a complete list of past U.S. presidents' names.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy