Computer Applications
A single dimensional array contains N elements. What will be the last subscript?
- N
- N - 1
- N - 2
- N + 1
Java Arrays
6 Likes
Answer
N - 1
Reason — The subscripts of an array range from 0 to size - 1. Thus, an array of size N will have the subscripts ranging from 0 to N - 1.
Answered By
2 Likes
Related Questions
Given array int Z[ ] = {15, 16, 17} ; it will occupy …………… bytes in memory.
- 3
- 12
- 24
- 64
In …………… search, the algorithm uses the middle value of the array for the search operation.
- binary
- linear
- bubble
- selection
Identify the output of the following code :
String P = "20", Q = "19"; int a = Integer.parseInt(P); int b = Integer.valueOf(Q); System.out.println(a + "" + b);- 2019
- 39
- 20
- 19
What will be the output of following code?
String c = "Hello i love java"; boolean var; var = c.startsWith("hello"); System.out.println(var);- true
- false
- 0
- 1