C Array Questions and Answers

Practice Mode
Showing 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"); }
  • A 2
  • B 3
  • C Compilation error
  • D 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)); }
  • A 1 3
  • B 1 5
  • C 3 5
  • D 3 7
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); }
  • A 4 2
  • B 2 3
  • C 4 3
  • D 2 2
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)); }
  • A s 1 k
  • B s a k
  • C k a k
  • D Garbage value
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]); }
  • A 2 8
  • B 8 8
  • C 8 10
  • D 2 2
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]); }
  • A 4.000000 4.000000
  • B 4.000000 1.000000
  • C 4.000000 5.000000
  • D None of these
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); }
  • A 1 2 3
  • B 1 5 9
  • C 1 4 7
  • D None of these
Answer: Option B
Q108
Find the output void main () { char s [ ]={78, 111, 32, 111, 117, 116, 112, 117, 116, 0}; printf("%s", s); }
  • A Compilation error
  • B Garbage value
  • C No ouput
  • D New year
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test