C# Collections MCQs

Question 16: Which of the following statements are TRUE for Indexer?

Question 17: What will be the output of the following code?

ArrayList myArryList = new ArrayList();
myArryList.Add(1);
myArryList.Add(1);
myArryList.Add("Two");
myArryList.Add(null);
myArryList.Add(null);
		
foreach (var val in myArryList)
	Console.Write(val);

Question 18: What will be the output of the following program?

SortedList sortedList = new SortedList()
                            {
                                {3, "Three"},
                                {4, "Four"},
                                {1, "One"},
                                {2, "Five"},
                                {2, "Two"}
                            };

foreach(DictionaryEntry kvp in sortedList )
    Console.Write(kvp.Key);

Question 19: What will be the output of the following code?

SortedList sortedList = new SortedList()
                            {
                                {3, "Three"},
                                {4, "Four"},
                                {1, "One"},
                                {2, null},
                                {6, null}
                            };
foreach(DictionaryEntry kvp in sortedList )
    Console.Write(kvp.Value);

Question 20: What will be the output of the following code?

SortedList sortedList = new SortedList()
                            {
                                {3, "Three"},
                                {4, "Four"},
                                {“One”,1},
                                {2, null},
                                {6, null}
                            };
foreach(DictionaryEntry kvp in sortedList )
    Console.Write(kvp.Value);