C-Array Questions and Answers
C-Array Questions and Answers
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]);
}
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));
}
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});
}
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);
}
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);
}
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));
}
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");
}
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