Complete the code to assign the smaller number to min using the ternary operator.
int a = 5; int b = 10; int min = (a < b) ? [1] : b;
b instead of a for the true part.The ternary operator checks if a < b. If true, it assigns a to min, otherwise b.
Complete the code to assign result as "Even" or "Odd" based on num.
int num = 7; string result = (num % 2 == 0) ? [1] : "Odd";
num instead of a string.The ternary operator checks if num is even. If true, it assigns "Even", else "Odd".
Fix the error in the ternary operator to assign status correctly.
int score = 85; string status = score >= 60 ? "Pass" [1] "Fail";
The ternary operator requires a colon : between the true and false expressions.
Fill both blanks to assign message based on age.
int age = 20; string message = (age >= [1]) ? "Adult" : [2];
If age is 18 or more, message is "Adult"; otherwise, it is "Minor".
Fill all three blanks to create a dictionary that maps numbers to "Even" or "Odd" strings.
var parity = new Dictionary<int, string>()
{
{1, [1],
{2, [2],
{3, [3]
};Numbers 1 and 3 are odd, so map to "Odd"; number 2 is even, so map to "Even".
