C Array Questions and Answers

Practice Mode
Showing 10 of 108 questions
Q21
Find the output void main ( ) { int a[ ]={6, 7, 8, 9}, i; compute (a); for (i=3, i>=0; i--) printf("%d", a[i]); } computer (int *p) { int i; for (i=0; i<4; i++){ *p=*p-1; p++; } }
  • A 5 6 7 8
  • B 6 7 8 9
  • C 8 7 6 5
  • D None of these
Answer: Option C
Q22
Find the output void main () { char *s [ ] ={"very""good""boy"}' printf("%s", s[0]; }
  • A very
  • B verygoodboy
  • C Compilation error
  • D None of these
Answer: Option B
Q23
Find the output void main () { int a[ ]={'1','2','3', '4', '5'}, i, for {i=0; i<5; i++) printf("%c",a[i]); }
  • A 49 50 51 52 53
  • B 1 2 3 4 5
  • C Run time error
  • D None of these
Answer: Option B
Q24
An array of mat [10][10] is given. What will be the number of adjacent element of mat[0][0];
  • A 2
  • B 1
  • C 0
  • D None of the above
Answer: Option A
Q25
Find the output void main ( ) { ffloat a [ ]={3.4, 5.7, 4.2, 8}; int i; for (i=0; i<4;i++) printf(%d", a[i]); }
  • A 3 5 4 2
  • B 3.000000 5.000000 4 2.000000
  • C Sufering
  • D None of these
Answer: Option C
Q26
Find the outpu void main ( ) { vhar a[ ] ={'ra', 'ma'); int i; for (i=0; i<sizeof (a)/ sizeof (char); i++ printf("%c", a[i]); }
  • A rm
  • B rama
  • C Error: charcter constant can't be two characters long
  • D None of these
Answer: Option A
Q27
Find the output void main () { int a [ ]= {1, 2, 3, 4, 5} ,i; for (i=4; i>0;) printf("%d", a[i--]); }
  • A 05432
  • B 54321
  • C 5432
  • D 4321
Answer: Option C
Q28
Find the output void main ( ) { char a[5]={'c', 'i', 't','e',o}; printf("%s", a[4]); }
  • A 0
  • B Null
  • C Compilation error
  • D NOne of these
Answer: Option B
Q29
Which of the following array can be read s a single entity?
  • A Integer array
  • B Float array
  • C Double array
  • D None of these
Answer: Option D
Q30
Find the output void main () { int a[2] [2] [3]={{1, 2, 3, 6, 7, 8}, {5, 7, 9, 3, 4, 1}}; printf("%d", *(*(*(a+1) +1)+1)); }
  • A 5
  • B 3
  • C 4
  • D 6
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test