17. Alpha and Beta are inhabitants of an island of knights and knaves, where knights always tell the truth and knaves always lie. Alpha and Beta are alone at a beach when Alpha says: "At least one of us is a knave." And Beta says: "We are both knaves." Which of the following is/are true? (a) Alpha and Beta are both knights (b) Alpha and Beta are both knaves (c) Alpha is a knight and Beta is a knave (d) Alpha is a knave and Beta is a knight
Questions 18 to 20 are based on the following code.
The two arguments to the function Mystery(A, n) in the code below are: (i) an integer array A indexed from 0 , and (ii) the number n of elements in A . Each element of A is an integer from the set $\{ 1,2 , \ldots , n \}$. The expression [0] $* ( \mathrm { n } + 1 )$ creates an array, indexed from 0 , that contains $n + 1$ zeroes. \begin{verbatim} function Mystery(A, n) { found = False; value = None; B = [0] * (n+1); for i from 1 to n { B[A[i]] = B[A[i]] + 1; } for i from 1 to n { if (found == False) { if (B[A[i]] == 1) { found = True; value = A[i]; } } } if (found == True) { return(value); } else { return(None); } } \end{verbatim} Answer the next three questions about this function. [0pt]
17. Alpha and Beta are inhabitants of an island of knights and knaves, where knights always tell the truth and knaves always lie. Alpha and Beta are alone at a beach when Alpha says: "At least one of us is a knave." And Beta says: "We are both knaves." Which of the following is/are true?\\
(a) Alpha and Beta are both knights\\
(b) Alpha and Beta are both knaves\\
(c) Alpha is a knight and Beta is a knave\\
(d) Alpha is a knave and Beta is a knight
\section*{Questions 18 to 20 are based on the following code.}
The two arguments to the function Mystery(A, n) in the code below are: (i) an integer array A indexed from 0 , and (ii) the number n of elements in A . Each element of A is an integer from the set $\{ 1,2 , \ldots , n \}$. The expression [0] $* ( \mathrm { n } + 1 )$ creates an array, indexed from 0 , that contains $n + 1$ zeroes.
\begin{verbatim}
function Mystery(A, n) {
found = False;
value = None;
B = [0] * (n+1);
for i from 1 to n {
B[A[i]] = B[A[i]] + 1;
}
for i from 1 to n {
if (found == False) {
if (B[A[i]] == 1) {
found = True;
value = A[i];
}
}
}
if (found == True) {
return(value);
} else {
return(None);
}
}
\end{verbatim}
Answer the next three questions about this function.\\[0pt]