Recall & Review
beginner
What does the && operator do in Ruby?
The && operator returns true only if both conditions on its sides are true. It's like saying "and" in everyday language.
Click to reveal answer
beginner
What is the purpose of the || operator?
The || operator returns true if at least one of the conditions is true. It's like saying "or" in everyday language.
Click to reveal answer
beginner
What does the ! operator do in Ruby?
The ! operator reverses the truth value. If something is true, ! makes it false, and if false, ! makes it true.
Click to reveal answer
beginner
What is the result of true && false in Ruby?
The result is false because both sides need to be true for && to return true.
Click to reveal answer
beginner
How does Ruby evaluate false || true?
Ruby returns true because || needs only one side to be true.
Click to reveal answer
What does the expression !(true && false) evaluate to in Ruby?
✗ Incorrect
true && false is false, and !false is true.
Which operator returns true if at least one condition is true?
✗ Incorrect
The || operator means 'or' and returns true if either side is true.
What is the result of false && true in Ruby?
✗ Incorrect
&& requires both sides to be true, so false && true is false.
What does the ! operator do to a true value?
✗ Incorrect
! reverses the truth value, so true becomes false.
Which expression is true in Ruby?
✗ Incorrect
!false is true.
Explain how the &&, ||, and ! operators work in Ruby with simple examples.
Think about how you decide things in daily life using 'and', 'or', and 'not'.
You got /4 concepts.
Describe a real-life situation where you would use each logical operator: &&, ||, and !.
Imagine deciding if you can go outside based on weather and homework.
You got /3 concepts.