Which code segment should you use?

You are developing an application that stores data about your company’s sales and technical support teams.
You need to ensure that the name and contact information for each person is available as a single collection when a user queries details about a specific team.
You also need to ensure that the data collection guarantees type safety.
Which code segment should you use?

You are developing an application that stores data about your company’s sales and technical support teams.
You need to ensure that the name and contact information for each person is available as a single collection when a user queries details about a specific team.
You also need to ensure that the data collection guarantees type safety.
Which code segment should you use?

A.
Hashtable team = new Hashtable();
team.Add(1, “Hance”);
team.Add(2, “Jim”);
team.Add(3, “Hanif”);
team.Add(4, “Kerim”);
team.Add(5, “Alex”);
team.Add(6, “Mark”);
team.Add(7, “Roger”);
team.Add(8, “Tommy”);

B.
ArrayList team = new ArrayList();
team.Add(“1, Hance”);
team.Add(“2, Jim”);
team.Add(“3, Hanif”);
team.Add(“4, Kerim”);
team.Add(“5, Alex”);
team.Add(“6, Mark”);
team.Add(“7, Roger”);
team.Add(“8, Tommy”);

C.
Dictionary team = new Dictionary();
team.Add(1, “Hance”);
team.Add(2, “Jim”);
team.Add(3, “Hanif”);
team.Add(4, “Kerim”);
team.Add(5, “Alex”);
team.Add(6, “Mark”);
team.Add(7, “Roger”);
team.Add(8, “Tommy”);

D.
string[] team = new string[] {“1, Hance”, “2, Jim”, “3, Hanif”, “4, Kerim”, “5, Alex”, “6, Mark”, “7, Roger”, “8, Tommy”};



Leave a Reply 1

Your email address will not be published. Required fields are marked *


seenagape

seenagape

I have the same idea. C