Anonymous user menu

Gate2006_50

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

X[i]=\(\Bigg\{\)1 if \(i \in X\), 0 otherwise

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

algorithm zzz(x[ ], y[ ], z [ ] ) {
int i;
for(i=0;i<n;++i)
z[i] = (x[i] \(\wedge\) ~y[i]) \(\vee\) (~x[i] \(\wedge\) y[i])
}

The set Z computed by the algorithm is:
(A) (X U Y )
(B) (X \(\cap\) Y )
(C) (X − Y ) \(\cap\) (Y − X )
(D) (X − Y ) U (Y − X )

Answer

Dicuss

0Comment