Page 343 - Computer science 868 Class 12
P. 343
else
System.out.print((char)( (?5?));
}
}
Answer the following questions:
(i) The statement or expression at ?l? is: [ISC 2022]
(a) 1 (b) 0
(c) -1 (d) 10
Ans. (b)
(ii) The statement or expression at ?2? is: [ISC 2022]
(a) num*num (b) num/b
(c) num%b (d) num
Ans. (c)
(iii) The statement or expression at ?3? is: [ISC 2022]
(a) x-1 (b) x
(c) x-2 (d) 0
Ans. (a)
(iv) The statement or expression at ?4? is: [ISC 2022]
(a) i<num (b) A[i]>num
(c) A(i]>10 (d) A(i]<10
Ans. (d)
(v) The statement or expression at ?5? is: [ISC 2022]
(a) A[i] (b) A[i]+55
(c) A[i]+65 (d) A(i]*10
Ans. (b)
5. The following program code sorts the columns of a double dimensional array in descending order using Bubble Sort technique.
There are some places in the code marked as ?1?, ?2?, ?3?, ?4? and ?5? which are to be replaced by a statement/expression so
that the code works properly.
void sortcol(int M[][])
{ int r=M.length;
int c=?1?;
int t;
for(int k=0; ?2?; k++)
for(int i=0;i<r;i++)
for(int j=0;j<r-1;j++)
{ if(?3?)
{?4?=M[j][k];
M[j][k]=?5?;
M[j+1][k]=t;
}
}
}
Answer the following questions:
(i) The statement or expression at ?1? is: [ISC 2022]
(a) M.length (b) M[0].length
(c) M.length() (d) M[1].length()
Ans. (b)
(ii) The statement or expression at ?2? is: [ISC 2022]
(a) k<=r (b) k<=c
(c) k<r (d) k < c
Ans. (d)
(iii) The statement or expression at ?3? is: [ISC 2022]
(a) M[j]<M[j+1] (b) M[k][j]<M[k][i+1]
(c) M[j][k]<M[j+1][k] (d) M[i][k]<M[i+1][k)
341
Arrays 341

