Complete the code to assign the list to another variable.
List<int> numbers = new List<int> {1, 2, 3};
List<int> copy = [1];Assigning numbers to copy makes both variables refer to the same list.
Complete the code to add an item to the list through the second reference.
List<string> fruits = new List<string> {"apple", "banana"};
List<string> basket = fruits;
basket.[1]("orange");Using Add adds a new item to the list referenced by both variables.
Fix the error in the code to correctly copy the list without shared state.
List<int> original = new List<int> {1, 2, 3};
List<int> copy = original.[1]();ToList() creates a new list with the same elements, avoiding shared state.
Fill both blanks to create a dictionary with word lengths for words longer than 3 characters.
var words = new List<string> {"cat", "house", "tree", "a"};
var lengths = words.Where(w => w.[1] > 3)
.ToDictionary(w => w, w => w.[2]);Use the Length property to get the length of a string in C#.
Fill all three blanks to create a dictionary with uppercase keys and values for words longer than 2 characters.
var words = new List<string> {"dog", "cat", "bird", "a"};
var result = words.Where(w => w.[1] > 2)
.ToDictionary(w => w.[2](), w => w.[3]());Use Length to check string length and ToUpper() to convert strings to uppercase.