Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. The attributes of three arithmetic operators in some programming language are given below.
    Operator Precedence Associativity Parity
    + High Left Binary
    Medium Right Binary
    * Low Left Binary

    The value of the expression 2 – 5 + 1 – 7 * 3 in this language is _________.
    1. 19
    2. 9
    3. 3
    4. 21
Correct Option: B

2 – 5 + 1 – 7 * 3 ⇒ 2 – (5 + 1) – 7 * 3
⇒ 2 – 6 – 7 * 3 ⇒ 2 – (6 – 7) * 3 ⇒ 2 – (–1) * 3
⇒ (2 + 1) * 3 ⇒ 3 * 3 = 9



Your comments will be displayed only after manual approval.