ICSE Class 10 Computer Applications Question 29 of 30

Solved Sample Paper 1 — Question 29

Back to all questions
29
Question

Question 2(ix)

If int a[] = {7, 3, 4, 8, 9, 2}; what are the values of x and y?

(a) x = a[1] * a[0] + a[3]

(b) y = a.length

Answer

(a) Since array index begin from 0, the given expression is evaluated as follows:

x = a[1] * a[0] + a[3]
⟹ x = 3 * 7 + 8
⟹ x = 29

(b) length of an array is the number of elements in an array. Thus, y = 6.