Recall & Review
beginner
What are arithmetic operators in C++?
Arithmetic operators are symbols used to perform basic math operations like addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).
Click to reveal answer
beginner
What does the modulus operator (%) do in C++?
The modulus operator (%) gives the remainder after dividing one number by another. For example, 7 % 3 equals 1 because 7 divided by 3 leaves a remainder of 1.
Click to reveal answer
intermediate
How does integer division differ from floating-point division in C++?
Integer division divides two integers and discards any decimal part, giving an integer result. Floating-point division divides numbers with decimals and keeps the fractional part.
Click to reveal answer
beginner
What will be the result of this C++ expression: 5 + 3 * 2?
The result is 11 because multiplication (*) has higher priority than addition (+). So, 3 * 2 = 6, then 5 + 6 = 11.
Click to reveal answer
beginner
Can arithmetic operators be used with floating-point numbers in C++?
Yes, arithmetic operators like +, -, *, and / can be used with floating-point numbers (like float or double) to perform math with decimals.
Click to reveal answer
Which operator gives the remainder of a division in C++?
✗ Incorrect
The % operator returns the remainder after division.
What is the result of 10 / 4 in C++ if both are integers?
✗ Incorrect
Integer division discards the decimal part, so 10 / 4 equals 2.
Which operator has the highest precedence in this expression: 4 + 5 * 6?
✗ Incorrect
Multiplication (*) has higher precedence than addition (+).
What is the output of 7 % 4 in C++?
✗ Incorrect
7 divided by 4 leaves a remainder of 3.
Can you use the + operator to add two double variables in C++?
✗ Incorrect
The + operator works with floating-point types like double.
Explain the difference between integer division and floating-point division in C++.
Think about dividing 7 by 2 using int and double types.
You got /3 concepts.
List all basic arithmetic operators in C++ and give a simple example of each.
Use numbers like 5 and 3 for examples.
You got /6 concepts.