wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Arrays by Swarn

Total questions: 10

Worksheet time: 15mins

Name
Class
Date
1.

In one array, we can store any number of elements of different types?

a)

Yes

b)

No

2.

Calculate and print total size of an array Arr[] of double data type having 15 elements in Bytes. (write only number)

(a)  

3.

What is the Base Type of any array?

a)

Size of array

b)

Data type of array

c)

First element of array

d)

Last element of array

4.

Write a java statement to print first element of an array Arr[]

a)

System.out.println(Arr);

b)

System.out.println(Arr[1]);

c)

System.out.println(Arr[0]);

d)

System.out.println(Arr[len-1]);

5.

Write a java statement to print last element of an array Arr[] (having 'n' elelments)-

System.out.println( (a)   );

6.

Write a java statement to print total number of elements of any array Arr[]

a)

System.out.println(Arr.length);

b)

System.out.println(Arr.count);

c)

System.out.println(Arr.length());

d)

System.out.println(Arr.length-1);

7.

What will be the output of following program snippet-


int Arr[]={ 2, 3, 4, 5};

for(int i=1; i<4; i++)

System.out.print(Arr[++i]+ “, ”);

a)

4,

b)

Error

c)

2,4,

d)

3,5,

8.

What will be the output of following program snippet-


int Arr[]=new int[5];

System.out.print(“Sum=”+Arr[1]+Arr[2]);

a)

No output

b)

Sum=00

c)

Sum=0

d)

Error

9.

Write a java statement to assign 3rd element of array Arr[] to 2nd element of same array

(a)  

10.

String Games[]={"Cricket", "Football","Hockey","Tennis"};

System.out.println(Games[2]);

a)

r

b)

Football

c)

Hockey

d)

i