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?
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
beginner
How does integer division behave in C#?
When you divide two integers, C# returns the whole number part only, dropping any decimal. For example, 7 / 3 equals 2, not 2.333.
Click to reveal answer
intermediate
What is 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
Explain the difference between / and % operators in C#.
The / operator divides two numbers and returns the quotient (the result of division). The % operator returns the remainder left after division. For example, 10 / 3 is 3, and 10 % 3 is 1.
Click to reveal answer
What is the output of: int result = 10 / 4; Console.WriteLine(result); ?
✗ Incorrect
Integer division drops the decimal part, so 10 / 4 equals 2.
Which operator gives the remainder of a division in C#?
✗ Incorrect
The % operator returns the remainder after division.
What is the result of: 8 + 2 * 5?
✗ Incorrect
Multiplication happens before addition: 2 * 5 = 10, then 8 + 10 = 18.
Which operator is used for multiplication in C#?
✗ Incorrect
The * symbol is used for multiplication.
What will be the output of: Console.WriteLine(15 % 4); ?
✗ Incorrect
15 divided by 4 leaves a remainder of 3, so 15 % 4 is 3.
Describe the main arithmetic operators in C# and give a simple example for each.
Think about +, -, *, /, and % symbols.
You got /6 concepts.
Explain how operator precedence affects the result of arithmetic expressions in C#.
Consider how 5 + 3 * 2 is calculated.
You got /4 concepts.