C-Array Questions and Answers

C-Array Questions and Answers
101. 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");
}

  • 2
  • 3
  • Compilation error
  • Not found
Show Answer
102. Find the output
void main ( )
{
int a[4]={1, 3, 5, 7};
int (*p) [4];
p=&a;
printf("%d %d,**p++,*(*p+1));
}
  • 1 3
  • 1 5
  • 3 5
  • 3 7
Show Answer
103. 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);
}

  • 4 2
  • 2 3
  • 4 3
  • 2 2
Show Answer
104. 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));
}

  • s 1 k
  • s a k
  • k a k
  • Garbage value
Show Answer
105. 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]);
}

  • 2 8
  • 8 8
  • 8 10
  • 2 2
Show Answer
106. 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]);
}

  • 4.000000 4.000000
  • 4.000000 1.000000
  • 4.000000 5.000000
  • None of these
Show Answer
107. 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);
}

  • 1 2 3
  • 1 5 9
  • 1 4 7
  • None of these
Show Answer
108. Find the output
void main ()
{
char s [ ]={78, 111, 32, 111, 117, 116, 112, 117, 116, 0};
printf("%s", s);
}

  • Compilation error
  • Garbage value
  • No ouput
  • New year
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test