🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित स्यूडोकोड का आउटपुट क्या होगा, जहां ^ XOR ऑपरेशन का प्रतिनिधित्व करता है?

What will be the output of the following pseudocode, where ^ represent XOR operation?

Integer a, b, c
Set b=5,a=1
c=a^b
print c
A)
B)
C)
D)

Explanation:

Sure! Here's a quick explanation:

  • a = 1 in binary: 0001
  • b = 5 in binary: 0101

XOR operation (^) compares bits:

  • 0 ^ 0 = 0
  • 0 ^ 1 = 1
  • 1 ^ 0 = 1
  • 1 ^ 1 = 0

When we XOR 0001 and 0101, the result is 0100, which is 4 in decimal.

Thus, the output is 4.

Answer: (A) 4.

Latest Updates