C# Collections MCQs

Question 11: Which of the following is FIFO (First In First Out) collection?

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

int[ , ] x = new int[ 3, 2 ]; 
Console.WriteLine(x.Length);

Question 13: Array can be resized dynamically in C#.

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

int[][][] arr = new int[2][][] 
{
    new int[2][]  
    { 
        new int[3] { 1, 2, 3},
        new int[2] { 4, 5} 
    },
    new int[1][]
    { 
	    new int[3] { 7, 8, 9}
    }
};

Console.WriteLine(arr[1][0][1]); 

Question 15: Indexer in C# is a special type of _________.

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);