Data Structures & AlgorithmsHardGATE CS · TCS NQT

The exponent operator ^ is right-associative. What is the value of 2 ^ 3 ^ 2?

  1. A. 64
  2. B. 512
  3. C. 520
  4. D. 112

Correct answer: B. 512

Right-associativity means 3 ^ 2 is computed first, giving 2 ^ 9 = 512. Left-to-right grouping (2^3)^2 = 64 is the trap.

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

Exams that ask this topic