Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 3 : 5 / 5

Advertisement

Detailed Solution

सही उत्तर 5 / 5 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What is the output of the following C code? `printf("%d", 5 & 3 | 4 ^ 1);` / निम्नलिखित C कोड का आउटपुट क्या होगा? `printf("%d", 5 & 3 | 4 ^ 1);`

1.
0 / 0
2.
7 / 7
3.
5 / 5
4.
1 / 1

Correct Answer: 5 / 5

Bitwise precedence is `&` over `^` over `|`: `5 & 3` = 1, `4 ^ 1` = 5, then `1 | 5` = 5. The trap is evaluating strictly left to right, which gives a different result. / Bitwise precedence है `&`, फिर `^`, फिर `|` : `5 & 3` = 1, `4 ^ 1` = 5, फिर `1 | 5` = 5। जाल पूरी तरह बाएँ-से-दाएँ मूल्यांकन करना है, जिससे भिन्न परिणाम मिलता है।

Downloaded from PrepSnap (prepsnap.in)