C Array Questions and Answers
Practice ModeShowing 10 of 108 questions
Q101
Find the output
void main ( )
{
char s[10];
char *p,c='1';
strcpy (s, "hello sir");
p=strchr (s, c);
if (p)
prntf("%d", p-s);
else
printf("Not found");
}
Answer: Option A
Q102
Find the output
void main ( )
{
int a[4]={1, 3, 5, 7};
int (*p) [4];
p=&a;
printf("%d %d,**p++,*(*p+1));
}
Answer: Option A
Q103
Find the output.
void main ()
{
int a[2] [3] [1]={1, 2, 3, 4, 5, 6};
int i=1;
printf(%d %d",
*(*(*(a+i++))), ***a+i);
}
Answer: Option A
Q104
Find the output.
void main ()
{
char sting [4] [1] [3]=
{"hi", "1a", "ks", "ya'};
printf("%c %c %c", *(sting [2][0]+1),
*(*sting [1]+1), ***(sting +2));
}
Answer: Option B
Q105
Find the output.
void main ()
{
int x[ ] [3]={2, 4, 6, 8, 10, 12};
int (*y) [3];
y=x;
printf("%d %d",
*(y+1) [0], *(y+0)[1]);
}
Answer: Option B
Q106
Find the output
void main ( )
{
float x [3] [2]={1, 2, 3, 4, 5, 6};
float (*y) [3];
y=x;
prrintf("%f %f", *(y+0) [1],* (y+1) [0]);
}
Answer: Option A
Q107
Find the output
void main ()
{
int a[ ] [3]={1, 2, 3, 4,5,6,7, 8, 9};
int i;
for (i=0; i<3; i++)
printf("%d", *(*(a+1))+i);
}
Answer: Option B
Q108
Find the output
void main ()
{
char s [ ]={78, 111, 32, 111, 117, 116, 112, 117, 116, 0};
printf("%s", s);
}
Answer: Option C