Here is correct question..

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

0 votes

Best answer

XOR(r1,r2) :- Microporcessor perform exclusive xor operation between r1 and r2 and store the result in r1.

Lets take an example, suppose r1 contains 1010 ( i.e 10 in decimal) and r2 contains 0110 ( i.e 6 in decimal )

Instructions are

XOR( r2, r1 ) :- XOR will happen between r2 and r1 and result will store in r2, 0110 XOR 1010 = 1100, so after this operation r1 contain 1010 and r2 contain 1100.

XOR (r1, r2 ) :- Similarly after this operation r1 contain 0110 and r2 contain 1100

XOR (r2, r1 ) :- Similarly after this operation r2 contains 1010 ( i.e 10 in decimal ) and r1 contains 0110 ( i.e 6 in decimal)

We can observe that, values of r1 and r2 get swapped after execution of these 3 instruction. Infact, its one of the way we swap two value using XOR operation.

None of the options are matching.

Lets take an example, suppose r1 contains 1010 ( i.e 10 in decimal) and r2 contains 0110 ( i.e 6 in decimal )

Instructions are

XOR( r2, r1 ) :- XOR will happen between r2 and r1 and result will store in r2, 0110 XOR 1010 = 1100, so after this operation r1 contain 1010 and r2 contain 1100.

XOR (r1, r2 ) :- Similarly after this operation r1 contain 0110 and r2 contain 1100

XOR (r2, r1 ) :- Similarly after this operation r2 contains 1010 ( i.e 10 in decimal ) and r1 contains 0110 ( i.e 6 in decimal)

We can observe that, values of r1 and r2 get swapped after execution of these 3 instruction. Infact, its one of the way we swap two value using XOR operation.

None of the options are matching.

- All categories
- General Aptitude 1.2k
- Engineering Mathematics 4.8k
- Digital Logic 2k
- Programming & DS 3.5k
- Algorithms 3k
- Theory of Computation 3.8k
- Compiler Design 1.5k
- Databases 2.8k
- CO & Architecture 2.5k
- Computer Networks 2.9k
- Non GATE 941
- Others 1.2k
- Admissions 334
- Exam Queries 410
- Tier 1 Placement Questions 17
- Job Queries 52
- Projects 8

34,234 questions

40,919 answers

116,193 comments

39,834 users