Given \(𝑖=0,𝑗=1,π‘˜=βˆ’1\) \( x = 0.5, y = 0.0\) What is the output of given…

2016

GivenΒ \(𝑖=0,𝑗=1,π‘˜=βˆ’1\)

\( x = 0.5, y = 0.0\)

What is the output of givenΒ \(β€˜C’\) expression?

x * 3 & & 3 || j | k

  1. A.

    - 1

  2. B.

    0

  3. C.

    1

  4. D.

    2

Attempted by 552 students.

Show answer & explanation

Correct answer: C

Solution: evaluate the arithmetic and then the logical/bitwise operations step by step.

  • Compute x * 3: 0.5 * 3 = 1.5, which is non-zero (true in a logical context).

  • Evaluate (x * 3) && 3: both operands are non-zero, so this logical AND yields 1.

  • Compute j | k: 1 | -1 = -1 (in two's complement, -1 has all bits set, so bitwise OR with 1 stays -1).

  • Final step: 1 || -1 is a logical OR of two non-zero values, which yields 1.

Therefore the expression evaluates to 1.

Explore the full course: Mppsc Assistant Professor