C-Array Questions and Answers
C-Array Questions and Answers
3. The only operatr that can act on the arrray as a whole is
- indirection operator
- sizeof operator
- { }
- [ ]
4. Which of the following is true about array?
- Array elements are stored in contiguous memory locations
- In c arrays are stored in row-major order
- An array can be declared as local as well as global
- All the above
5. Identify the true statement
- memory allocated by an array can be deallocated using free () function
- C also supports zero length array
- array can be used to hold dissimilar kinds of data
- working beyond array size is not risky
6. Fnd the output
'void main ( )
{
char a[4]="rama";
char b[ ] ="shyama";
printf{"%d %d", sizeof (a), sizeof (b));
}
'void main ( )
{
char a[4]="rama";
char b[ ] ="shyama";
printf{"%d %d", sizeof (a), sizeof (b));
}
- 4 7
- 5 6
- 5 7
- 4 6
7. Find the output
void main ()
{
char a[ ] ="rama";
har b [ ]=a;
printf("%d %s", sizeof (b), b);
}
void main ()
{
char a[ ] ="rama";
har b [ ]=a;
printf("%d %s", sizeof (b), b);
}
- 5 rama
- 4 rama
- 5 r
- Compilation error
8. Find the output
void main()
{
int a[ ] ={'a'a, 'b', 'c'};
printf("%d", sizeof (a));
}
void main()
{
int a[ ] ={'a'a, 'b', 'c'};
printf("%d", sizeof (a));
}
- 3
- 4
- Can't be initialized
- None of these
9. It is said that the arrray uses "zero-basee addressing"because
- Array size must be an integer greater than zero
- The array subscript must always start at zero.
- Array declaration reserves memory during compilation
- None of these
10. Which is the about array ?
- Array can be dynamic
- Using malloc, memory an be allocated for array during run time
- Unused memory can't be used at the time of requirement
- None of these