C Array Questions and Answers
Practice ModeShowing 10 of 108 questions
Q11
The function strstr () returns
Answer: Option B
Q12
Which of the following is/are wrong ?
int a,b[5], c[3]
I. a=b[2];
II. b[3]=a;
III. b[1]=c[2];
IV. C[0]=B[2];
Answer: Option D
Q13
Find the output
void main()
{ int a[ ] ={1, 2, 3, 4, 5}, k=1;
while (k<=5)
{
printf("%d", k[a-1]);
k++;
}
}
Answer: Option B
Q14
How to measure total size of an integer array ?
Answer: Option B
Q15
Which of the following is/are false regarding array ?
I. Array index starts from -1.
II. Array elements are stored in contiguous memory location.
III. The size of the array should be mentioned while declaraing.
IV. Array elements can be accessed using the inded of array
Answer: Option A
Q16
What heppens when subscript used for an array exceeds the array size ?
Answer: Option D
Q17
Find the output.
void main ()
{
static int a[ ]={1 2, 3, 4, 5};
int i;
for (i=0; i<5; i++)
{
*(a+i)=a[i] + i[a];
printf(%d", * (i+a));
}
Answer: Option A
Q18
Find the output
void main ( )
{
int a[] ={1, 2, 3, 4, 5}, i;
for (i=0; i<5; i++)
{
if (i<3);
printf("%d",a[i]);
else
printf("hi");
}
}
Answer: Option D
Q19
The array a[j][k] is equivalent to
Answer: Option C
Q20
Find the output
void main ( )
{
int a [ ] = {4, 5, 6, 7, 8}, i, *p;
for (p=a+4, i=2; i<=4; i++)
printf ("%d",p[-i]);
}
Answer: Option B