Complete the code to access the element at index 2 in the array.
int[] numbers = {1, 2, 3, 4, 5};
int value = numbers[[1]];The array index starts at 0, so index 2 accesses the third element which is 3.
Complete the code to check if a key exists in the dictionary.
Dictionary<string, int> ages = new Dictionary<string, int> { {"Alice", 30}, {"Bob", 25} };
bool hasKey = ages.[1]("Alice");Use ContainsKey to check if a dictionary has a specific key.
Fix the error in the linked list traversal to print all values.
LinkedList<int> list = new LinkedList<int>(new int[] {10, 20, 30});
LinkedListNode<int> current = list.First;
while (current != null) {
Console.WriteLine(current.Value);
current = current.[1];
}The correct property to move to the next node is Next with uppercase 'N'.
Fill both blanks to populate a dictionary that includes only keys with values greater than 10.
var filtered = new Dictionary<string, int>(); foreach (var kvp in data) { if (kvp.Value [1] 10) { filtered.[2](kvp.Key, kvp.Value); } }
Use '>' to check if value is greater than 10 and 'Add' to add key-value pairs to the dictionary.
Fill all three blanks to create a dictionary from a list where keys are the words and values are their lengths, but only include words longer than 3 characters.
var words = new List<string> {"cat", "house", "dog", "elephant"};
var result = new Dictionary<string, int>();
foreach (var word in words) {
if (word.[2] [3] 3) {
result.Add([1], word.[2]);
}
}Use 'word' as key, 'Length' property for value, and '>' to filter words longer than 3 characters.
