PRASHNIKAप्रश्निका
‹ Back to the paper

With reference to the program code given below, answer the following question: void single(int x[])…

Computer Science20222 marksMCQ
With reference to the program code given below, answer the following question:
void single(int x[])
{
    int w = 1;
    for(int y = 0; y < x.length; y++)
    {
        if(x[y] % 2 == 0 && x[y] > 0)
            w = w * x[y];
    }
    System.out.print(w);
}
What will be the output of the method single() when the value of `x[] = {10,2,9,-6,5,6}`?
  • (i)120
  • (ii)45
  • (iii)720
  • (iv)18

Answer

No answer yet.

Arrays, Strings

From ISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1, question 29(a).