Option B is wrong. For this we must do
int A[5] = {0};
as part of initialization.
Option D is also wrong - C compiler don't do this - it sometimes warn though. Not all array out of bound cannot be checked also by the C compiler.
When we declare int A[5], that means size of array A[] is 5, which can store values in memory locations from A to A+4. Now, when we want to store some value outside of this range, two things can happen:
- Invalid memory access error can be thrown - often segmentation fault - option A
- Memory might have been allocated by compiler for someother purpose and so there won't be any error. -option C.
So, correct answer should be "None of these" as sometimes is not always.
PS: These kind of questions are never asked for GATE. Ofcourse with no correct answer, it should not be asked anywhere but in GATE questions related to errors are quite rare.