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
91. Find the output void main () { char *p; char b[10]={1, 2, 3, 4, 5, 6, 7, 8}; p=(b+1) [5]; printf("%d",p); }
- 9
- 7
- Compilation error
- None of these
92. Find the output void main ( ) { char s [ ]="041"; int x; x=atoi (s) ; printf("%d", x); }
- 041
- 41
- 0
- None of these
93. Find the output void main ( ) { int a[ ][3]={1,2,3,4, 0, 6}; orubtf(%d %d", *(*a+1)); }
- 2 4
- 4 2
- 2 2
- None of these
94. Find the output void main ( ) { char a[5]="Good night"; printf("%s", a); }
- Good
- Good night
- Compilation error
- None of these
95. Find the output void main ( ) { int a[2] [2] [2] ={1, 2, 3, 4, 5, 6, 7, 8); printff("%d", *(a[0])); }
- The value of a[0][0][0]
- The value of a[1][1][1]
- The address off a[0][0][0]
- The address of a a[1][1][1]
96. Find the output void main ( ) { int a[5]; int *p=&a[3]; p[-2]=5; [[-1]=10; p[-3]=15; printf("%d", p[2]); }
- 10
- 15
- 5
- Garbage value
97. Find the output void main ( ) { char *s [ ]="rabi", "manoj", "bubu"}; printf("%s %s %s", *s, ++*s, *(s+2)); }
- rabi manoj bubu
- bubu majoj rabi
- abi abi bubu
- rabi abi bubu
98. Find the output int a[ ]={3, 7, 9, 11}, count; call ( ) { return ++count; } void main ( ) { a[count++]=call (); printf("%d", a[count]); }
- 1
- 2
- 3
- None of these
99. Find the output void main ( ) { char ch [ ]=?welcome"; omt o=0; while (i<strlen (ch)) putchar (ch[i++] | 32); }
- welcome
- WELCOME
- Welcome
- None of these
100. Find the output. void main() { int arr[5]= { }, i; char *p; for (i=0; i<5,i++) arr [i]=i; p=(char*) arr; printf("%d %d", p, arr+1); }
- 1 2
- 1 3
- Garbage garbage
- Compilation error