Computer Applications
A single dimensional array contains 37 elements. Which of the following represents the index of its second-to-last element.
Java Arrays
1 Like
Answer
35
Reason — In Java, arrays use zero-based indexing. For an array with 37 elements, the indices range from 0 to 36:
- The last element is at index
36. - The second-to-last element is at index
35(36 - 1).
Answered By
1 Like
Related Questions
Name the below structure:

- One dimensional array
- Two Dimensional array with 4 rows and 5 columns
- Three dimensional array
- Two Dimensional array with 5 rows and 4 columns
Define a class to accept values into 4x4 array and find and display the sum of each row.
Example:
A[][]={{1,2,3,4},{5,6,7,8},{1,3,5,7},{2,5,3,1}}
Output:
sum of row 1 = 10 (1+2+3+4) sum of row 2 = 26 (5+6+7+8) sum of row 3 = 16 (1+3+5+7) sum of row 4 = 11 (2+5+3+1)Write a Java program to store n numbers in an one dimensional array. Pass this array to a function number(int a[]). Display only those numbers whose sum of digit is prime.
Consider the following two-dimensional array and answer the questions given below:
int x[ ][ ] = {{4,3,2}, {7,8,2}, {8, 3,10}, {1, 2, 9}};(a) What is the order of the array?
(b) What is the value of x[0][0]+x[2][2]?