Complete the code to check if two strings are equal using the == operator.
string a = "hello"; string b = "hello"; bool areEqual = a [1] b;
The == operator compares the content of two strings for equality in C#.
Complete the code to compare two strings ignoring case using String.Equals method.
string a = "Hello"; string b = "hello"; bool areEqual = String.Equals(a, b, [1]);
StringComparison.OrdinalIgnoreCase compares strings ignoring case differences.
Fix the error in the code to correctly compare two strings for equality using the Equals method.
string a = "test"; string b = "test"; bool areEqual = a.Equals([1]);
The Equals method compares the current string with the string passed as argument. Passing variable b compares the two strings.
Fill both blanks to create a dictionary that maps strings to their lengths, but only include strings with length greater than 3.
var words = new List<string> { "apple", "bat", "carrot", "dog" };
var lengths = words.ToDictionary(word => word, word => word.[1]);
var filtered = lengths.Where(kv => kv.Value [2] 3).ToDictionary(kv => kv.Key, kv => kv.Value);word.Length gets the length of the string. Filtering with > 3 keeps only words longer than 3 characters.
Fill all three blanks to create a dictionary with uppercase keys and values only for strings that start with 'a'.
var words = new List<string> { "apple", "banana", "apricot", "cherry" };
var result = words.Where(word => word.[1]("a")).ToDictionary(word => word.[2](), word => word.[3]());StartsWith("a") filters words starting with 'a'. ToUpper() converts strings to uppercase for keys and values.