Questions: Operators and Expressions

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

What does the expression `7 / 2` evaluate to in a language that uses integer division when both operands are integers?

A3.5
B3
C4
D1
Question 2 Multiple Choice

Consider the condition: `if (x != 0 and 10 / x > 2)`. If x equals 0, what happens?

AA division-by-zero error occurs because both sides of `and` are always evaluated
BThe condition evaluates safely to false because short-circuit evaluation skips the division
CThe condition evaluates to true because 0 satisfies the `!=` check
DThe program crashes because `and` requires both operands to be computed before combining them
Question 3 True / False

Writing `if (x = 5)` instead of `if (x == 5)` in most C-style languages will cause an immediate syntax error that stops the program from running.

TTrue
FFalse
Question 4 True / False

The modulo operator `%` is primarily useful for checking whether a number is even or odd.

TTrue
FFalse
Question 5 Short Answer

Why does operator precedence matter in programming, and how does it relate to order of operations from math?

Think about your answer, then reveal below.