Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the result of the expression if x=15 and y=12:
  2. A.
    b1101
    B.
    0b1101
    C.
    12
    D.
    1101

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    The symbol '&' represents bitwise AND. This gives 1 if both the bits are equal to 1, else it gives 0. The binary form of 15 is 1111 and that of 12 is 1100. Hence on performing the bitwise AND operation, we get 1100, which is equal to 12.


Be The First To Comment