You are on page 1of 4

void main() { int const * p=5; printf("%d",++(*p)); }

A. COMPILER ERROR(correct answer)


B. 6
C. ADDRESS VALUE(your answer)
D. 5
E. NONE

2. main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[


i ],*(s+i),*(i+s),i[s]); }
A. mmm
aaaa
nnnnn
B. mmmmm
aaa
nnnn
C. mmmm
aaaa
nnnn
(correct answer)
D. mmm
aaa
nnn
E. NONE

3. 6. main() { extern int i; i=20; printf("%d",i); }


A. LINKER ERROR(correct answer)
B. COMPILER ERROR
C. 20
D. ADDRESS
E. NON

(1)
void main(){
float a=30.3f;
int y=5;
clrscr();
printf("%d",a%y);
getch();
}
What will be output when you will compile above code?
(a) 6
(b) 6.0
(c) 7
(d) Compiler error
(e) None of these
(2)
void main(){
int x=5;
float r=5.0;
clrscr();
printf("%x %X %o",sizeof(x,r),sizeof(r,x),sizeof(sizeof(5.0)));
getch();
}
What will be output when you will compile above code?
(a) 4 2 2
(b) 2 4 4
(c) 2 4 2
(d) Compiler error
(e) None of these
(3)
void main(){
int y=15,z=25;
function(&y,&z);
clrscr();
printf("%d\t%d",z,y);
getch();
}
function (int *p,int *q){
return(*p=(*p+*q)-(*q=*p));
}
What will be output when you will compile above code?
(a) 25 15
(b) 15 25
(c) 25 25
(d) Compiler error
(e) None of these
(4)
void main(){
int a=-1;
static int count;
clrscr();
while(a){
count++;
a&=a-1;
}
printf("%d",count);
getch();
}
What will be output when you will compile above code?
(a) 15
(b) 16
(c) 17
(d) Compiler error
(e) None of these
(5)
void main(){
typedef float arr[10];
arr b={2,4,6};
clrscr();
printf("%d",sizeof(b));
getch();
}
What will be output when you will compile above code?
(a) 40
(b) 12
(c) 4
(d) Compiler error
(e) None of these
(6)
void change(int const *p){
*((int *)p)=20;
}
void main(){
int const x=10;
change(&x);
clrscr();
printf("%d",x);
getch();
}
What will be output when you will compile above code?
(a) 10
(b) 20
(c) 30
(d) Compiler error
(e) None of these
Solution:
(1)(d) Modular division is only possible for integral data type
(2)(a)
(3)(b)
(4)(b)
(5)(a)
(6)(b)

You might also like