C Language (Day-09)
C Language (Day-09)
Gorakhpur Center
Ministry of Electronics & Information Technology (MeitY), Government of India
i row
a[0][0] a[0][1] a[0][2]
j column a[i][j]
a[1][0] a[1][1] a[1][2]
a[2][0] a[2][1] a[2][2]
1. What will be the output of the following C 2. What will be the output of the following C code?
code? #include <stdio.h>
#include <stdio.h> void main()
void main() {
{ int a[2][3] = {1, 2, 3, , 4, 5};
int a[2][3] = {1, 2, 3, 4, 5}; int i = 0, j = 0;
int i = 0, j = 0; for (i = 0; i < 2; i++)
for (i = 0; i < 2; i++) for (j = 0; j < 3; j++)
for (j = 0; j < 3; j++) printf("%d", a[i][j]);
printf("%d", a[i][j]); }
} a) 1 2 3 junk 4 5
a) 1 2 3 4 5 0 b) Compile time error
b) 1 2 3 4 5 junk c) 1 2 3 0 4 5
c) 1 2 3 4 5 5 d) 1 2 3 3 4 5
d) Run time error Answer: b
Answer: a
9. An array of similar data types which themselves are a collection of dissimilar data type are
___________
a) Linked Lists b) Trees
c) Array of Structure d) All of the mentioned Answer: c