MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which programming language has arrays whose index doesn’t have to start at 0?
A
Pascal
B
Perl
C
VBA
D
C
Explanation: 

Detailed explanation-1: -There are 20 Programming Languages in the World where the array index starts from 1 and not from 0. Some of the popular languages include R, COBOL, Matlab and Julia. Most programmers think that array indices start with 0 always but this is not the case. The start index of 0 or 1 is decided based on various factors.

Detailed explanation-2: -Arrays are indexed starting at 0, as opposed to starting at 1. The first element of the array above is vector[0]. The index to the last value in the array is the array size minus one.

Detailed explanation-3: -In modern-day computer science, most programming languages such as Python, Ruby, PHP, Java have array indices starting at zero.

Detailed explanation-4: -JavaScript arrays are zero-indexed: the first element of an array is at index 0, the second is at index 1, and so on-and the last element is at the value of the array’s length property minus 1 .

Detailed explanation-5: -Access arrays with numeric values All arrays in Perl start at 0. Arrays can also be accessed from the end by using negative offsets from the end. Reading a non-existent element gives undef .

There is 1 question to complete.