Recall & Review
beginner
What are relational operators in C?
Relational operators compare two values and return either true (1) or false (0) based on the comparison.
Click to reveal answer
beginner
List the six relational operators in C.
The six relational operators are: < (less than), > (greater than), <= (less than or equal to), >= (greater than or equal to), == (equal to), != (not equal to).
Click to reveal answer
beginner
What is the result type of a relational operator in C?
The result is an integer: 1 if the relation is true, 0 if false.
Click to reveal answer
beginner
Explain the difference between == and = in C.
== is a relational operator that checks if two values are equal. = is an assignment operator that sets a value to a variable.
Click to reveal answer
beginner
What will the expression (5 > 3) return in C?
It returns 1 because 5 is greater than 3, so the condition is true.
Click to reveal answer
Which operator checks if two values are NOT equal in C?
✗ Incorrect
!= means not equal, so it returns true if values differ.
What does the expression (7 <= 7) evaluate to?
✗ Incorrect
7 is less than or equal to 7, so the expression is true and returns 1.
Which relational operator means 'greater than or equal to'?
✗ Incorrect
>= means greater than or equal to.
What is the result type of a relational operator in C?
✗ Incorrect
Relational operators return int: 1 for true, 0 for false.
Which operator is used to assign a value to a variable?
✗ Incorrect
= assigns a value; == compares values.
Explain what relational operators do in C and list all six operators.
Think about how you compare numbers in real life, like checking if one number is bigger or equal to another.
You got /8 concepts.
Describe the difference between the assignment operator and the equality operator in C.
Remember: one is for giving a value, the other is for checking values.
You got /3 concepts.