The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes

asked in Digital Logic by Boss (5.8k points) | 42 views

Here is correct question..

1 Answer

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.
answered by Boss (7.5k points)
selected by

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,234 questions
40,919 answers
39,834 users