Wednesday, 8 November 2017

Array Questions in C


Find Output Array Questions
Print Out Correct Questions
Yes/No Array Questions
------------------------------------------------------------------------------------------------
1. 
What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.

Answer: C

Explanation:
If the index of the array size is exceeded, the program will crash. Hence "option c" is the correct answer. But the modern compilers will take care of this kind of errors.
--------------------------------------------------------------------------------------------------------
2.
What does the following declaration mean?
int (*ptr)[10];

A. ptr is array of pointers to 10 integers
B. ptr is a pointer to an array of 10 integers
C. ptr is an array of 10 integers
D. ptr is an pointer to array

Answer: B
------------------------------------------------------------------------------------------------------------
3.
In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Address of the last element of array

Answer: C
------------------------------------------------------------------------------------------------------------

More Imp :

Print Out Correct Questions
Yes/No Array Questions

100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...