“8 is an even number.”
This statement is true.
CodeBhavya
Learn how statements become true or false, combine them using logical operators and evaluate conditions used in mathematics, algorithms and computer programs.
A proposition is a declarative statement that has exactly one truth value: either true or false.
This statement is true.
This statement is false.
A command does not have a truth value.
A question is neither true nor false.
We write T for true and F for false. The NOT operator reverses a truth value.
| P | ¬P |
|---|---|
| T | F |
| F | T |
The result is true only when P and Q are both true.
The result is false only when both statements are false.
The result is true when P and Q have different values.
| P | Q | P ∧ Q | P ∨ Q | P ⊕ Q |
|---|---|---|---|---|
| T | T | T | T | F |
| T | F | F | T | T |
| F | T | F | T | T |
| F | F | F | F | F |
It is false only when P is true but Q is false.
It is true when P and Q have the same truth value.
| P | Q | P → Q | P ↔ Q |
|---|---|---|---|
| T | T | T | T |
| T | F | F | F |
| F | T | T | F |
| F | F | T | T |
A truth table checks an expression under every possible combination of truth values.
A compound expression contains more than one operator. Use parentheses whenever they make the intended order clearer.
Evaluate (P ∨ Q) ∧ ¬P when P = F and Q = T.
First, P ∨ Q = F ∨ T = T.
Next, ¬P = ¬F = T.
Finally, T ∧ T = T.
Final truth value: T
Two expressions are logically equivalent when their final truth-table columns match for every row.
“If P then Q” can be rewritten using NOT and OR.
NOT of AND becomes OR of the negated statements.
NOT of OR becomes AND of the negated statements.
P ∨ ¬P
P ∧ ¬P
P ∧ Q
Select a logical expression. The builder evaluates it for all four combinations of P and Q and explains its meaning.
| P | Q | Result |
|---|
Programming conditions use the same reasoning as mathematical logic. The symbols may change, but the truth rules remain the same.
| Logic | C / Java-style symbol | Example meaning |
|---|---|---|
| NOT | ! |
!isEmpty: the collection is not empty |
| AND | && |
age >= 18 && hasId: both requirements hold |
| OR | || |
isAdmin || isOwner: either permission is enough |
| XOR idea | != for Boolean values |
Exactly one of two Boolean choices is true |
validBooking && activeId.
Evaluate P ∧ ¬Q when P = T and Q = F.
¬Q = ¬F = T.
P ∧ ¬Q = T ∧ T = T.
Answer: T
Classify P ∨ ¬P.
If P is true, P ∨ ¬P is T ∨ F = T.
If P is false, P ∨ ¬P is F ∨ T = T.
Answer: It is a tautology.
A portal permits access when a user is an administrator OR has both a valid account and an active subscription. Write the logical expression.
Let A = administrator, V = valid account and S = active subscription.
The two valid paths are A, or V together with S.
Answer: A ∨ (V ∧ S)
Decide each answer before opening the solution. Use a small truth table whenever the result is not immediately clear.
1. Is “x + 4 = 10” a proposition when x has not been specified?
2. Evaluate P ∨ Q when P = F and Q = T.
3. When is P → Q false?
4. Apply De Morgan’s law to ¬(P ∨ Q).
5. Evaluate (P ⊕ Q) ∧ R for P = T, Q = F and R = T.
You have learned, visualized, solved and revised the topic. Now answer all 20 questions and submit once. Your score, correct answers and explanations appear only after submission.