Computer Applications
The sum of a[1] and a[3] in the array int a[] = {20, 40, 60, 80, 100} is:
- 80
- 100
- 120
- 60
Java Arrays
3 Likes
Answer
120
Reason — In the array int a[] = {20, 40, 60, 80, 100}, the index starts from 0.
a[1]refers to the second element: 40a[3]refers to the fourth element: 80
So, the sum is: 40 + 80 = 120.
Answered By
3 Likes
Related Questions
How many bytes are occupied by the below two-dimensional array?
156 20 154 20 130 20 130 20 162 17.67 161 20 158 17.5 154 20 - 96 bytes
- 128 bytes
- 12 bytes
- 24 bytes
A girl wanted to calculate the sum of two numbers stored as a and b multiplied by 7. Select the appropriate Java expression.
- a + b*7
- 7*a + b
- (a + b)*7
- a + 7*b
State which access specifier is less restrictive.

- private
- protected
- default
- public
The AMB hotel gives the amount to be paid by the customer as an integer, which of the following Math method rounds off the bill in decimals to an integer?
- Math.round()
- Math.pow()
- Math.ceil()
- Math.abs()