Which of the following statements are correct about the program below?
#include
int main()
{
int size, i;
scanf("%d", &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf("%d", arr[i]);
printf("%d", arr[i]);
}
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
Choose the correct statements
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
void fun(int **p);
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}
Answer: A
No answer description available for this question.
Enter details here
Which of these best describes an array?
Answer: B
Array contains elements only of the same type
Enter details here
If n has the value 3, then the statement
Answer: B
No answer description available for this question.
Enter details here
What will be the output of the program ?
#include
int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
Array can be considered as set of elements stored in consecutive memory locations but having __________.
Answer: A
Array store elements of same data type.
Enter details here
If storage class is missing in the array definition, by default it will be taken to be
Answer: A
No answer description available for this question.
Enter details here
The following program
main( )
{
static int a[ ] = { 7, 8, 9 } ;
printf( "%d", 2[ a ] + a[ 2 ] ) ;
}
Answer: D
a[2] will be converted to *(a + 2).
*(a + 2) can as well be written as *(2 + a ) .
*(2 + a ) is nothing but 2 [a] . So. a [2] is essentially same as 2 [a] which is same as * ( 2 + a ). So. it prints 9 + 9 = 18. Some of the modem compilers don't accept 2[a].
Enter details here
Array base address in C language
Answer: A
No answer description available for this question.
Enter details here