Computer Science, asked by arjunreddy8272, 5 months ago

 Consider the given statements regarding Arrays-

1. Arrays provide a linear medium to store data.

2. Arrays provide a non indexed structure.

3. All the elements in Array depend on the location of the other elements of the Array.

Which of the above statements is/are true?

Only 1              B. Both 1 and 2        C. Both 1 and 3        D. 1, 2 and 3

Answers

Answered by Oreki
3

Answer:

C. Both Statements 1 and 3 are correct.

Answered by syed2020ashaels
0

Answer: option c that is both 1 and 2

Explanation:

An array is a collection of items of the same data type stored in contiguous memory locations.

This makes it easy to calculate the position of each element by simply adding an offset to the base value, i.e. the memory location of the first array element (generally denoted by the array name). The base value is index 0 and the difference between the two indices is the offset.

For simplicity, we can think of an array as a set of stairs where a value (say one of your friends) is placed on each step. Here you can locate any of your friends simply by knowing the number of steps they are on.

In C, an array has a fixed size, once its size is given, it cannot be changed, i.e. you cannot shrink or expand it. The reason was that when expanding if we resize, we can't be sure (it's not possible every time) that we'll get the extra storage space for free. Minification won't work because the array gets statically allocated memory when it's declared, so the compiler is the only one who can destroy it.

#SPJ5

Similar questions