1. The if statement in C# always requires an else statement. True False 2. When
ID: 3891199 • Letter: 1
Question
1. The if statement in C# always requires an else statement. True False 2. When using an AND in a logical expression, both statements must evaluate to true for the expression to evaluate to true. True False 3. The string type may be used as an expression in the switch statement to be evaluated. True False 4. The default statement is required when using the SWITCH statement. True False 5. Which operator represents the AND in a conditional expression? & AND | | && 6. The logical operators in C# are ___. >, <, >=, <= != and == && and == ==, =, and != 7. Given the following code, what is the value of A? int temperature = 85; // if the height is greater than 70, return "Tall", otherwise return "Not Tall" string A = inches > 70 ? "Cold" : "Hot"; "Cold" "Hot" 8. The statement below is an example of ____. if(x > 100) { Console.WriteLine("true") } else { Console.WriteLine("false"); } an iteration statement a two-way if statement a one-way if statement a simple sequence statement 9. If the value of x is 100, what would be printed to the console? if(x > 100) { Console.WriteLine("true") } else { Console.WriteLine("false"); } True False 10. The equality operator in C# is ____. == != equals =
Explanation / Answer
1. False (if can work without else)
2. True
3. True
string x = "hot";
switch(x)
{
case "hot": Console.WriteLine("hot");
break;
case "cold": Console.WriteLine("cold");
break;
default: Console.WriteLine("default");
break;
}
4. False
5. &&
6. &&
7. A = "Cold" ( condition is true )
8. a two-way if statement
9. False (condistion is false, else will execute)
10. == and !=
Do ask if any doubt. Please upvote.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.