Complete the code to declare an array of integers with 5 elements.
int[] numbers = new int[1];In C#, arrays are declared using square brackets []. So to create an array of 5 integers, use new int[5].
Complete the code to add a new node with value 10 at the start of a linked list.
Node newNode = new Node(10); newNode.[1] = head; head = newNode;
In a singly linked list, each node points to the next node using the 'next' property.
Fix the error in the code to correctly traverse a linked list and print values.
Node current = head; while (current != null) { Console.WriteLine(current.Value); current = current.[1]; }
To move through a singly linked list, update current to current.next each time.
Fill both blanks to create a list of squares for numbers 1 to 5 using an array.
int[] squares = new int[5]; for (int i = 0; i [1] 5; i++) { squares[i] = (i + 1)[2]2; }
The loop runs while i is less than 5 (i < 5). To square a number, multiply it by itself using '*'.
Fill all three blanks to create a dictionary from words to their lengths, filtering words longer than 3 characters.
var result = new Dictionary<string, int>(); foreach (var word in words) { if (word.[1] > [2]) { result[word] = word.[3]; } }
Use 'Length' property to get word length. Filter words with length > 3. Assign word length to dictionary.
