Recall & Review
beginner
What are relational operators in Go?
Relational operators compare two values and return a boolean result: true or false. They help decide if one value is equal to, greater than, or less than another.
Click to reveal answer
beginner
List the common relational operators in Go.
== (equal to), != (not equal to), < (less than), <= (less than or equal to), > (greater than), >= (greater than or equal to).
Click to reveal answer
beginner
What does the expression '5 < 10' return in Go?
It returns true because 5 is less than 10.
Click to reveal answer
intermediate
Can relational operators be used with strings in Go?
Yes, strings can be compared using relational operators like == and != to check equality or inequality. Also, < and > compare strings lexicographically (dictionary order).
Click to reveal answer
beginner
What is the result of '7 != 7' in Go?
It returns false because 7 is equal to 7, so they are not different.
Click to reveal answer
Which operator checks if two values are NOT equal in Go?
✗ Incorrect
The '!=' operator returns true if the two values are different.
What does the expression '10 >= 5' evaluate to?
✗ Incorrect
10 is greater than or equal to 5, so the expression is true.
Which relational operator means 'less than or equal to'?
✗ Incorrect
The '<=' operator means less than or equal to.
Can you use relational operators to compare two strings in Go?
✗ Incorrect
Go allows comparing strings with ==, !=, <, >, <=, and >=.
What is the result of '3 == 4' in Go?
✗ Incorrect
3 is not equal to 4, so the expression returns false.
Explain what relational operators do in Go and give examples.
Think about how you compare numbers or words in real life.
You got /3 concepts.
Describe how you can compare strings using relational operators in Go.
Imagine checking if two words are the same or which comes first alphabetically.
You got /3 concepts.