About C Interview Questions on Arrays
This C Interview Questions -Arrays post is a collection of interview questions on Arrays in C language including one dimension arrays, two-dimensional and multidimensional arrays.
C Interview Questions-Arrays
What is Array?
Derived data type.
Used to store more than one element of the Same type.
Syntax to Declare array?
What are the advantages of Array?
Used to process the information like phone numbers, account numbers, student marks….
Can we declare Array variables globally?
Global variable array elements implicitly initialize with default values.
What are the default values of a local variable array of integer type?
Can we initialize an array directly?
yes, we can initialize array directly using assignment operator.
How can we process array elements?
We can process array elements only by using iterators(loops).
Can we store heterogeneous data elements in an array?
No, arrays are intended to store only homogeneous elements.
What array variable holds?
Base address(first location address) of the memory block(array).
How to access array elements?
Accessing array elements using its index starting from 0 to size-1 of the array.
Can we pass an array as an argument to function?
Yes, it is allowed to pass an array as a parameter in function calling process.
Passing array is nothing but passing base address of the array.
What is a two-dimensional array?
Used to process the data of two-dimensional format(rows and columns) for example matrix.
What is the use of 2-dimensional array?
Used to process the information in rows and columns.
for example Matrix.
What is a Multi dimensional array?
More than the two-dimensional array is coming under the multi dimensional array.
How to process elements of the 2-dimensional array?
We can process 2-dimensional array of elements using nested loops.
Can a function return an array?
Yes possible but using pointers.