PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

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<int, string> team = new Dictionary<int, string>();
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