MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In terms of an array, what is an index?
A
A value which points to a data element in an array
B
The first element in an array
C
A list of all the elements in an array
D
None of the above
Explanation: 

Detailed explanation-1: -Index − Each location of an element in an array has a numerical index, which is used to identify the element.

Detailed explanation-2: -The index indicates the position of the element within the array (starting from 1) and is either a number or a field containing a number.

Detailed explanation-3: -Arrays in C act to store related data under a single variable name with an index, also known as a subscript. It is easiest to think of an array as simply a list or ordered grouping for variables of the same type.

Detailed explanation-4: -An array is an indexed collection of data elements of the same type. 1) Indexed means that the array elements are numbered (starting at 0). 2) The restriction of the same type is an important one, because arrays are stored in consecutive memory cells. Every cell must be the same type (and therefore, the same size).

Detailed explanation-5: -You can refer to the first element of the array as myArray[0], the second element of the array as myArray[1], etc… The index of the elements begins with zero.

There is 1 question to complete.

BUY E-BOOK WITH ANSWER KEYS GIVEN AT THE END OF EVERY PAGE