russell.michael4
russell.michael4 Sep 3, 2026 • 10 views

Assignment Operators Quiz for High School Students

Hey there! 👋 Get ready to test your knowledge of assignment operators. I've put together a quick study guide and a practice quiz to help you ace your next computer science test. Let's dive in! 💻
💻 Computer Science & Technology
🪄

🚀 Can't Find Your Exact Topic?

Let our AI Worksheet Generator create custom study notes, online quizzes, and printable PDFs in seconds. 100% Free!

✨ Generate Custom Content

1 Answers

✅ Best Answer
User Avatar
sarahgeorge1985 Jan 1, 2026

📚 Quick Study Guide

  • 🧮 Assignment operators are used to assign values to variables.
  • ➕ The basic assignment operator is `=` which assigns the value on the right to the variable on the left (e.g., `$x = 5;` assigns the value 5 to the variable $x$).
  • ➡️ `+=` (Add and Assign): Adds the right operand to the left operand and assigns the result to the left operand (e.g., `$x += 3;` is the same as `$x = x + 3;`).
  • ➖ `-=` (Subtract and Assign): Subtracts the right operand from the left operand and assigns the result to the left operand (e.g., `$x -= 3;` is the same as `$x = x - 3;`).
  • ✖️ `*=` (Multiply and Assign): Multiplies the left operand by the right operand and assigns the result to the left operand (e.g., `$x *= 3;` is the same as `$x = x * 3;`).
  • ➗ `/=` (Divide and Assign): Divides the left operand by the right operand and assigns the result to the left operand (e.g., `$x /= 3;` is the same as `$x = x / 3;`).
  • 💯 `%=` (Modulo and Assign): Takes the modulo of the left operand by the right operand and assigns the result to the left operand (e.g., `$x %= 3;` is the same as `$x = x % 3;`).

🧪 Practice Quiz

  1. What is the value of $x$ after the operation `$x = 5; x += 3;`?
    1. A. 5
    2. B. 3
    3. C. 8
    4. D. 2
  2. Which assignment operator is used to multiply a variable by a value and assign the result back to the variable?
    1. A. `+=`
    2. B. `-=`
    3. C. `*=`
    4. D. `/=`
  3. What is the value of $y$ after the operation `$y = 10; y %= 3;`?
    1. A. 1
    2. B. 3
    3. C. 10
    4. D. 0
  4. Which of the following is equivalent to `$a = a - 5;`?
    1. A. `$a += 5;`
    2. B. `$a -= 5;`
    3. C. `$a *= 5;`
    4. D. `$a /= 5;`
  5. What will be the output of the following code snippet: `$num = 20; $num /= 4; echo $num;`?
    1. A. 20
    2. B. 4
    3. C. 5
    4. D. 0
  6. If $z = 7$, what is the value of $z$ after the operation `$z *= 2;`?
    1. A. 7
    2. B. 9
    3. C. 14
    4. D. 5
  7. Which assignment operator calculates the remainder of a division?
    1. A. `+=`
    2. B. `-=`
    3. C. `*=`
    4. D. `%=`
Click to see Answers
  1. C
  2. C
  3. A
  4. B
  5. C
  6. C
  7. D

Join the discussion

Please log in to post your answer.

Log In

Earn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! 🚀