Font size
WorksheetsArrays by Swarn
Total questions: 10
Worksheet time: 15mins
In one array, we can store any number of elements of different types?
Yes
No
Calculate and print total size of an array Arr[] of double data type having 15 elements in Bytes. (write only number)
(a)
What is the Base Type of any array?
Size of array
Data type of array
First element of array
Last element of array
Write a java statement to print first element of an array Arr[]
System.out.println(Arr);
System.out.println(Arr[1]);
System.out.println(Arr[0]);
System.out.println(Arr[len-1]);
Write a java statement to print last element of an array Arr[] (having 'n' elelments)-
System.out.println( (a) );
Write a java statement to print total number of elements of any array Arr[]
System.out.println(Arr.length);
System.out.println(Arr.count);
System.out.println(Arr.length());
System.out.println(Arr.length-1);
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]+ “, ”);
4,
Error
2,4,
3,5,
What will be the output of following program snippet-
int Arr[]=new int[5];
System.out.print(“Sum=”+Arr[1]+Arr[2]);
No output
Sum=00
Sum=0
Error
Write a java statement to assign 3rd element of array Arr[] to 2nd element of same array
(a)
String Games[]={"Cricket", "Football","Hockey","Tennis"};
System.out.println(Games[2]);
r
Football
Hockey
i
