Complete the code to make the recursive call for factorial calculation.
int Factorial(int n) {
if (n <= 1) return 1;
return n * Factorial([1]);
}The factorial of n is n multiplied by factorial of (n-1). So the recursive call must be Factorial(n - 1).
Complete the code to print numbers from n down to 1 using recursion.
void PrintDescending(int n) {
if (n == 0) return;
Console.WriteLine(n);
PrintDescending([1]);
}To print numbers from n down to 1, we reduce n by 1 in each recursive call.
Complete the recursive calls for the Fibonacci function.
int Fibonacci(int n) {
if (n <= 1) return n;
return Fibonacci([1]) + Fibonacci([2]);
}The nth Fibonacci number is the sum of the two preceding ones: Fibonacci(n) = Fibonacci(n-1) + Fibonacci(n-2).
Fill both blanks to create a LINQ expression that builds a dictionary mapping words to their lengths for words longer than 3 characters.
var lengths = words.Where(word => word.Length > 3).ToDictionary([1], [2]);
The dictionary maps each word (key) to its length (value). So the key is 'word' and the value is 'word.Length'.
Fill all three blanks to build a dictionary that maps uppercase words to their lengths for words longer than 3 characters.
var result = new Dictionary<string, int>(); foreach (var word in words) { if (word.Length > [1]) { result[[2]] = [3]; } }
The condition checks if word length is greater than 3. The key is the uppercase word, and the value is the word's length.
