Recall & Review
beginner
What is Disjunctive Normal Form (DNF) in logic?
DNF is a way to write logical expressions as an OR of ANDs. Each AND group contains only variables or their negations, and the whole expression is a combination of these groups connected by OR.
Click to reveal answer
beginner
How can DNF be useful in programming?
DNF helps simplify complex logical conditions by breaking them into simpler parts. This makes it easier to evaluate, optimize, or convert logic into code like PHP if-statements.
Click to reveal answer
beginner
In PHP, how would you represent a DNF expression like (A AND B) OR (NOT C AND D)?
You can use boolean operators: ($A && $B) || (!$C && $D). This matches the DNF structure of OR between AND groups.
Click to reveal answer
intermediate
What does it mean if a logical expression is not in DNF?
It means the expression might have ORs inside ANDs or other complex nesting. DNF requires the top-level operator to be OR, with AND groups inside.
Click to reveal answer
intermediate
Why might converting to DNF cause an expression to grow larger?
Because distributing AND over OR can duplicate parts of the expression, making it longer and more complex, especially with many variables.
Click to reveal answer
Which of the following is a valid DNF expression?
✗ Incorrect
DNF requires OR of AND groups. Option C matches this. Option B has OR inside AND, not allowed in DNF.
In PHP, which operator represents logical AND?
✗ Incorrect
&& is the logical AND operator in PHP.
What does the 'NOT' operator do in logical expressions?
✗ Incorrect
NOT reverses true to false and false to true.
Why is DNF useful in programming?
✗ Incorrect
DNF standardizes logic to OR of ANDs, making evaluation easier.
What happens when you convert a complex expression to DNF?
✗ Incorrect
Distributing OR over AND can duplicate parts, increasing length.
Explain what Disjunctive Normal Form (DNF) is and why it is useful in programming.
Think about how logic can be broken into simpler parts.
You got /3 concepts.
Describe how you would write a DNF logical expression in PHP code.
Remember PHP boolean operators.
You got /4 concepts.