C - Operators and ExpressionsGiven two boolean variables p and q, which expression correctly checks if exactly one is true?A!(p || q)Bp && qCp || qD(p && !q) || (!p && q)Check Answer
Step-by-Step SolutionSolution:Step 1: Understand exclusive OR logicExactly one true means p true and q false OR p false and q true.Step 2: Match expression(p && !q) || (!p && q) matches this logic.Final Answer:(p && !q) || (!p && q) -> Option DQuick Check:Exclusive OR = (p && !q) || (!p && q) [OK]Quick Trick: Exactly one true = (p && !q) || (!p && q) [OK]Common Mistakes:Using p && q (both true)Using p || q (any true)Negating OR incorrectly
Master "Operators and Expressions" in C9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Quizzes C Basics and Execution Environment - Writing first C program - Quiz 10hard Conditional Statements - If–else statement - Quiz 1easy Conditional Statements - Why conditional logic is needed - Quiz 3easy Loop Control Statements - Continue statement - Quiz 1easy Loop Control Statements - Continue statement - Quiz 3easy Loops - For loop - Quiz 2easy Operators and Expressions - Operator precedence - Quiz 10hard Variables and Data Types - Why variables are needed - Quiz 10hard Variables and Data Types - Variable declaration and initialization - Quiz 10hard Variables and Data Types - Why variables are needed - Quiz 4medium