230k views
1 vote
Which statement will create a queue of strings called colorsUnlimited?

A) Queue colorsUnlimited;
B) Queue colorsUnlimited = new Queue();
C) colorsUnlimited = new Queue();
D) Queue colorsUnlimited = new Queue();

1 Answer

1 vote

Final answer:

Option D: Queue colorsUnlimited = new Queue(); is the correct statement to create a queue called colorsUnlimited that holds strings. It properly declares and initializes the queue with the correct type specification.

Step-by-step explanation:

The question is asking for the correct syntax to create a queue that can hold strings in a programming context. Among the options given, Option D is the correct answer: Queue colorsUnlimited = new Queue();

This statement declares a variable colorsUnlimited of type Queue which will store strings, and it also initializes this variable with a new instance of a Queue. It is important to specify the type of objects the queue will hold; in this case, it's String objects. Note that the exact syntax might vary depending on the programming language used, and in some languages, you might need to import the Queue class before using it.

User Omri Gazitt
by
7.7k points