‹ Back to the paper
With reference to the program code given below, answer the following question: void single(int x[])…
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 is the method single() performing?- (i)Sum of the positive odd elements
- (ii)Product of the even elements
- (iii)Product of the positive even elements
- (iv)Sum of the positive even elements
Answer
No answer yet.
From ISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1, question 29(b).