Bird
0
0

You have a variable $score starting at 50. Write PHP code using compound assignment to add 10, then multiply by 3, and finally subtract 5. What is the final value of $score?

hard📝 Application Q8 of 15
PHP - Operators
You have a variable $score starting at 50. Write PHP code using compound assignment to add 10, then multiply by 3, and finally subtract 5. What is the final value of $score?
A1655
B1650
C175
D155
Step-by-Step Solution
Solution:
  1. Step 1: Add 10 to $score

    Starting at 50, $score += 10; makes $score 60.
  2. Step 2: Multiply $score by 3

    $score *= 3; updates $score to 180.
  3. Step 3: Subtract 5 from $score

    $score -= 5; results in 175.
  4. Final Answer:

    175 -> Option C
  5. Quick Check:

    Compound assignments applied stepwise = 175 [OK]
Quick Trick: Apply compound assignments in order for correct result [OK]
Common Mistakes:
  • Multiplying before adding
  • Subtracting before multiplying
  • Incorrect order of operations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes