## Microsoft Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
1
of 1 vote

previous comment was bitwise xor
for logical xor would be
srry i didnt read the question correctly
#define XOR(a,b) (((a)&&(!(b)))||(((!a))&&(b)))

Comment hidden because of low score. Click to expand.
0

Or simply, a != b

Comment hidden because of low score. Click to expand.
0
of 0 vote

a||b?(a&&b?false:true):false

Comment hidden because of low score. Click to expand.
0
of 0 vote

(a&^b) | (^a&b)

Comment hidden because of low score. Click to expand.
0
of 0 vote

(!!a) ^ (!!b)

Comment hidden because of low score. Click to expand.
0

It's equivalent to a ^ b isn't it? That doesn't really answer the question...

Comment hidden because of low score. Click to expand.
0
of 0 vote

(a&&~b)||(~a&&b)

Comment hidden because of low score. Click to expand.
0
of 0 vote

(a&&!b)||(!a&&b)

Comment hidden because of low score. Click to expand.
0
of 0 vote

Can anybody highlight why we cannot use simple a^b ??

Comment hidden because of low score. Click to expand.
0

lol..

Comment hidden because of low score. Click to expand.
0

Logical xor, not bitwise...

Comment hidden because of low score. Click to expand.
0
of 0 vote

The Question was we must not use any if else logic and obvious ur not supposed to use ^ operator

Comment hidden because of low score. Click to expand.
0
of 0 vote

a XOR b = ( a | b ) & ( !a | !b )

Comment hidden because of low score. Click to expand.
0
of 0 vote

a XOR b = (a & !b) | (!a & b)

Comment hidden because of low score. Click to expand.
0
of 0 vote

# define ex_or(a,b) (a^b)

Comment hidden because of low score. Click to expand.
0

Hilarious.. :)

Comment hidden because of low score. Click to expand.
0
of 0 vote

#define XOR(a,b) (((a)&(!(b)))|((!(a))&b))

Comment hidden because of low score. Click to expand.
0
of 0 vote

previous comment is not correct
#define XOR(a,b) (((a)&(~(b)))|((~(a))&b))

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.