A set X can be represented by an array x[n] as follows: \[x[i]=\begin{cases}1…
GATE · 2006 · CS
A set X can be represented by an array x[n] as follows:
\[x[i]=\begin{cases}1 & \text{if }i\in X,\\0 & \text{otherwise.}\end{cases}\]
Consider the following language-independent pseudocode, in which x, y, and z are Boolean arrays of size n. Here, ∧, ∨, and ~ denote Boolean AND, OR, and NOT, respectively; they are mathematical symbols, not C operators.
algorithm zzz(x[], y[], z[]) {
int i;
for (i = 0; i < n; ++i)
z[i] = (x[i] ∧ ~y[i]) ∨ (~x[i] ∧ y[i]);
}The set Z computed by the algorithm is:
- A.
(X ∪ Y)
- B.
(X ∩ Y)
- C.
(X − Y) ∩ (Y − X)
- D.
(X − Y) ∪ (Y − X)
Attempted by 228 students.
Show answer
Correct answer: D
Explore the full course: Iocl Engineers Officers Grade A Paper 2
Loading lesson…