Complete the code to declare a lambda that adds two integers.
Func<int, int, int> add = (x, y) => x [1] y;The lambda expression uses the + operator to add x and y.
Complete the code to declare a lambda that checks if a number is even.
Func<int, bool> isEven = n => n [1] 2 == 0;
The % operator gives the remainder. If remainder is 0 when divided by 2, the number is even.
Fix the error in the lambda that returns the square of a number.
Func<int, int> square = x => x [1] 2;
In C#, the multiplication operator * is used to square a number. The ** operator is not valid.
Fill the blank to create a lambda that filters numbers greater than 10.
Func<int, bool> isGreaterThanTen = n => n [1] 10;
The lambda checks if n is greater than 10 using the > operator.
Fill all three blanks to create a lambda that returns a dictionary of words and their lengths for words longer than 3 characters.
var lengths = words.Where(w => w.Length [1] 3).ToDictionary([2] => [3].ToLower(), [2] => [2].Length);
The lambda filters words with length greater than 3 using >. Then ToDictionary uses w as the key selector and w.Length as the value selector. The key is converted to lowercase with w.ToLower().