GATE | GATE-CS-2006 | Question 50

A set X can be represented by an array x[n] as follows:

gate_2006_50

Consider the following algorithm in which x,y and z are Boolean arrays of size n:



filter_none

edit
close

play_arrow

link
brightness_4
code

algorithm zzz(x[] , y[], z [])
{
   int i;
   for (i=O; i<n; ++i)
     z[i] = (x[i] ^ ~y[i]) V (~x[i] ^ y[i])
}

chevron_right


The set Z computed by the algorithm is:
(A) (X ∩ Y)
(B) (X ∪ Y)
(C) (X-Y) ∩ (Y-X)
(D) (X-Y) ∪ (Y-X)


Answer: (D)

Explanation: Same as http://quiz.geeksforgeeks.org/algorithms-misc-question-4/

Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.