C multiple choice questions and answers
1.
The array a[j][k] is equivalent
to
2.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int
a[]={6,7,8,9},i;
compute(a);
for (i=3;i>=0;i--)
printf(“%d”,a[i]);
return 0;
}
compute ( int *p){
int i;
for (i=0;i<4;i++){
*p=*p-1;
p++;
}
}
3.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int a[]={4,5,6,7,8},i,*p;
for (p=a+4,i=2;i<=4;i++)
printf(“%d”,p[-i]);
return 0;
}
Explanation:
**
4.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int a[2][2][3]={{1,2,3,6,7,8},
{5,7,9,3,4,1}
};
printf(“%d”,*(*(*(a+1)+1)+1));
return 0;
}
5.
What will be output of the
following c program?
#include <stdio.h>
int main(){
char str[]= "HELLO" ;
char *p= "HAI" ;
str= "INDIA" ;
printf( "%s" ,str);
return 0;
}
6.
What will be output of the
following c program?
#include <stdio.h>
int main(){
char * emp name=
"raja";
printf( "%s" ,emp name);
return 0;
}
7.
What will be output of the
following c program?
#include <stdio.h>
int main(){
long int new=5l;
printf( "%ld" ,new);
return 0;
}
8.
What will be output of the
following c program?
#include <stdio.h>
int main(){
long int _=5l;
printf( "%ld" ,_);
return 0;
}
9.
What will be output of the
following c program?
#include <stdio.h>
int main(){
char * __WORLD__= "world" ;
printf( "%s
" ,__WORLD__);
return 0;
}
10.
What will be output of the
following c program?
#include <stdio.h>
int main(){
char * __TIME__= "world" ;
printf( "%s
" ,__TIME__);
return 0;
}
11.
What will be output of the
following c program?
#include <stdio.h>
int main(){
long int a;
( float )a=6.5;
printf( "%f" ,a);
return 0;
}
12.
What will be output of the
following c program?
#include <stdio.h>
int main(){
long int a,b=10;
++a=b++;
printf( "%d %d" ,a,b);
return 0;
}
13.
What will be output of the
following c program?
#include <stdio.h>
int main(){
long int a,b=5;;
~a=++b + ++b +
++b;
printf( "%d %d" ,++a,++b);
return 0;
}
14.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int x;
int y;
x+y=10;
x=3;
printf( "%d" ,y);
return 0;
}
15.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int x=5;
int y=10;
&x=y;
printf( "%d
%d" ,x,y);
return 0;
}
16.
What will be output of the
following c program?
#include <stdio.h>
int main(){
const a=10;
a=~a;
printf( "%d" ,a);
return 0;
}
17.
What will be output of the
following c program?
#include <stdio.h>
int main(){
const _=10;
int *p=&_;
printf( "%d" ,*p);
}
18.
What will be output of the
following c program?
#include <stdio.h>
int main(){
const int *a=12;
a++;
printf( "%d" ,a);
return 0;
}
19.
What will be output of the
following c program?
#include <stdio.h>
int main(){
const int *a=( const int * )12;
*a=( const int *)25;
printf( "%d" ,a);
return 0;
}
20.
What will be output of the
following c program?
#include <stdio.h>
int main(){
int * const a=( int * const )12;
a=25;
printf( "%d" ,a);
return 0;
}
6 comments:
very very helpful....
thanx sir
thanx sir......
in c,what is the benifit of storing negative number in 2's compliment?
excellent questions.....keep publishing such qeustions.......thnx a lot!
What will be output of the following c program?
#include
int main(){
int a[]={4,5,6,7,8},i,*p;
for(p=a+4,i=2;i<=4;i++)
printf(“%d”,p[-i]);
return 0;
}
It's Answer Will Be 654 not 8 7 6 5 4 , Please Be Sure While Writing your answer,It confuse User.
What will be output of the following c program?
#include
int main(){
int a[2][2][3]={{1,2,3,6,7,8},
{5,7,9,3,4,1}
};
printf(“%d”,*(*(*(a+1)+1)+1));
return 0;
}
It's Answer Will be 4, 1*2*3+1*3+1 = 10
helpful......
Post a Comment