Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does the assignment expression x = 5; do?
Think about what happens on the left and right of the equal sign.
Rewrite the expression a = a + 2; using a compound assignment operator.
Look for ways to combine the operation with assignment.
What does the expression a += 3; mean?
Think about how the operator combines addition with assignment.
True or False: The expression b = b * 2; can be rewritten as b *= 2;.
Identify the equivalence of both expressions.
Design a set of variables to represent a bank account transaction system. Use assignment operators to update the balance after deposits and withdrawals.
Think of the balance as starting at zero, adding or subtracting for each transaction.
You have a variable for total score in an exam. If the score starts at 50 and you score 10 points on two different tests, show how you update it using assignment expressions.
Consider how many tests you took and the points you earned.
4 more questions in this section. Enroll free to practise them all.
Enroll free