Difficulty: Easy
Correct Answer: 1, 2, 3
Explanation:
Introduction / Context:In C#, logical operators operate on Boolean expressions. Knowing which tokens are logical is essential to write clear, correct conditions.
Given Data / Assumptions:
Concept / Approach:C# supports logical AND (&&), logical OR (||), and logical NOT (!). These are Boolean operators; && and || also short-circuit. C# does not have a keyword Xor; exclusive-or is the bitwise operator ^. The percent sign % is the remainder operator, not logical.
Step-by-Step Solution:
Identify logical operators: &&, ||, ! → items 1, 2, 3.Exclude Xor (VB keyword; in C# use ^) and % (arithmetic remainder).Verification / Alternative check:Compile sample conditions showing that &&, ||, ! operate on bool; try Xor and see it fail in C#; % only works on numeric types.
Why Other Options Are Wrong:They include non-logical or non-C# keywords.
Common Pitfalls:Confusing VB's Xor with C#'s ^; mixing arithmetic with logical operators.
Final Answer:1, 2, 3
Discussion & Comments