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