C Array Questions and Answers
Arrays in C language form the foundation of data storage and manipulation. They store multiple values of the same type under a single variable name, allowing efficient data handling. Programming questions and answers related to arrays frequently appear in campus placement exams and coding interviews by TCS, Wipro, and Capgemini. This topic includes C array questions with answers covering array declaration, initialization, multidimensional arrays, and pointer relations. Practicing these problems will enhance your understanding of indexing, memory usage, and algorithm design for real-world applications.
C Array
Showing 10 of
108 questions
21. 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++; } }
- 5 6 7 8
- 6 7 8 9
- 8 7 6 5
- None of these
22. Find the output void main () { char *s [ ] ={"very""good""boy"}' printf("%s", s[0]; }
- very
- verygoodboy
- Compilation error
- None of these
23. Find the output void main () { int a[ ]={'1','2','3', '4', '5'}, i, for {i=0; i<5; i++) printf("%c",a[i]); }
- 49 50 51 52 53
- 1 2 3 4 5
- Run time error
- None of these
24. An array of mat [10][10] is given. What will be the number of adjacent element of mat[0][0];
- 2
- 1
- 0
- None of the above
25. 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]); }
- 3 5 4 2
- 3.000000 5.000000 4 2.000000
- Sufering
- None of these
26. Find the outpu void main ( ) { vhar a[ ] ={'ra', 'ma'); int i; for (i=0; i<sizeof (a)/ sizeof (char); i++ printf("%c", a[i]); }
- rm
- rama
- Error: charcter constant can't be two characters long
- None of these
27. Find the output void main () { int a [ ]= {1, 2, 3, 4, 5} ,i; for (i=4; i>0;) printf("%d", a[i--]); }
- 05432
- 54321
- 5432
- 4321
28. Find the output void main ( ) { char a[5]={'c', 'i', 't','e',o}; printf("%s", a[4]); }
- 0
- Null
- Compilation error
- NOne of these
29. Which of the following array can be read s a single entity?
- Integer array
- Float array
- Double array
- None of these
30. 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)); }
- 5
- 3
- 4
- 6