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
51. The maximum number of non-zero elements in the ith row in a lower trinangular array with in rows is
- i
- i+1
- n
- None of the above
52. An array is caled sparse array in which
- None of the elements are zero
- Maximum numbers of elements of arrays are zero.
- All the elements of arrays are zero.
- None of the above
53. Find the output. void main ( ) { int a[ ]= {1, 2, 3, 4, 5}; printf ("%", &a[5]-&a[1]); }
- 4
- 8
- 3
- Garbage value
54. Find the output void main ( ) short *a[5]; printf (%d", sizeof (a)); }
- error, pointer an't be declared like that
- 2
- 10
- Garbage value
55. Find the correct statement.
- int a=10; int arr[a];
- int *p={&a,&b,&c};
- static int a,b,c; int *q[ ]={&a, &b}
- int a=1, b=2, c=3; int arr[ ]={a, b, c};
56. Find the output. void main () { int a[ ]={1, 2, 3, 4, 5, 6, 7, 8, 9} printf ("%", a[2, 3, 5}); }
- 6
- 3
- 346
- Compilation error
57. Find the output. void main () { int i,j; int matrix [ ] [3]=(1, 2, 3, 4, 5, 6, 7, 8, 9); for (i=1; i<=2; i++) for (j=1; j<=2;j++) printf("%d", *(*matrix+j)+1); }
- 1479
- 5869
- 4567
- None of these
58. Find the output void main () { char *p, *q, *r; p="abc"; q="defg hijk"; r="1mno"; strncat(p, strrev (q), strlen (r)); printf("%s",p); }
- abcgfed
- abckjih
- abcdefg
- cbagfed
59. Find the output void main () { char c[ ]={'1','2','3','4'},*p; p=&c[2]; printf("%d",++(*p)); }
- 3
- 21
- 4
- None of these
60. Find the output. void main ( ) { char *p="CITE"; char *q="CITE"; if (p==q) printf("Both are equal"); else printf("Not equal"); }
- Both are equal
- Not equal
- Error
- None of these