in Others retagged by
355 views
0 votes
0 votes

The bitwise $\text{OR}$ of $35$ with $7$ in $C$ will be :

  1. $35$
  2. $7$
  3. $42$
  4. $39$
in Others retagged by
355 views

2 Answers

0 votes
0 votes

Ans: D) 39

Explanation:    

0 votes
0 votes
In C programming bitwise OR (|) takes two numbers and performs OR operation on every bit of two numbers.

Note: The result of OR operation is $1$ if any one of the two-bit is $1$ else $0$.

below here conversion from decimal to binary number system to perform bitwise OR operations.

$(35)_{10}=(100011)_2$

$(7)_{10}=(000111)_2$

$\frac{\begin{matrix} &35&=  &100011 \\ | &7 &= &000111   \end{matrix}} {\begin{matrix}  &39 &= &100111\end{matrix}}$

Option $(D)$ is correct.
edited by