Data Structures & AlgorithmsHardTCS NQT · Infosys

Evaluate the integer expression 2 - 3 * 4 + 10 / 3 using standard precedence and integer division that truncates toward zero. What is the result?

  1. A. -6
  2. B. -7
  3. C. -9
  4. D. 5

Correct answer: B. -7

Multiplication and division come before addition and subtraction, and 10 / 3 truncates to 3. Evaluating left to right gives a different result.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic