mail ur answers to ssanthosh_13@yahoo.com
1.
#include
#include
void main()
{
int i=-2,j=-1,k;
k=i+++j;
j=i-+-j;
i=i+--j;
printf("%d%d%d",k,j,i);
}
a) -3-3-4 b)-2-2-5 c)-3-3-5 d)-2-3-4
2.
#include
#include
void main()
{
int i=-2,j=2,k=0,m;
clrscr();
m=++i||++j&&++k;
printf("%d%d%d%d",i,j,k,m);
getch();
}
a) -12111 b)-12001 c)-13111 d)-121010
3.
include
#include
#include
void main()
{
int a[5]={2,3,4,5,6},j;
clrscr();
printf("%d",(a+4)-(a+2));
getch();
}
a) 4 b) 2 c) 6 d) Error
4.
#include
#include
void swap(int* a,int* b);
void main()
{
int x=10,y=8;
swap(&x,&y);
printf("x==%d y==%d ",x,y);
}
void swap(int* a,int* b)
{
*a^=*b;
*b^=*a;
*a^=*b;
}
a) carbage value b) compile time error c) 8 10 d)run time error
5.
#include
#include
#include
void main()
{
int i=3,j=4;
clrscr();
if((i++&j++)||(--i||++j))
printf("Yes");
else
printf("No");
printf("%d%d",i,j);
getch();
}
a)yes 45 b)no 35 c)yes 35 d)no 36
6.
#include
#include
#define exp(x) x*x++
void main()
{
int i=3,j=2,k;
clrscr();
k=exp(i)*exp(j)+exp(i);
printf("%d %d",i,k);
getch();
}
a)4 52 b)5 52 c) 4 45 d)5 45
7.
#include
#include
#include
void main()
{
int i=3,j=2,k;
char c[5]={'3','2'};
clrscr();
j=atoi(c);
printf("%d %d %d %c %c",i--,+-i,j,c[0],c[3]);
getch();
}
a) 3 -2 3 3 0 b) 3 -3 32 3 c) 3-2 32 3 d) 3 -2 32 3 0
8.
#include
#include
void main()
{
int j=2;
char *c="2";
clrscr();
j=atoi(c);
j*2;
switch(j)
{
default:
printf("The Style ");
case 0:
printf("The lover ");
break;
case 1:
printf("The terror ");
break;
case 2:
printf("The fun ");
break;
case 3:
printf("The reformer");
}
getch();
}
a) The fun b)The style The lover c)The lover d)Error
9.
#include
#include
void main()
{
int a[5]={2,3,4,5,6},j;
clrscr();
j=*(a+4)/*(a+1);
printf("%d",j);
getch();
}
a) 3 b) 2 c) 4 d) Error
10.
Which of the following is not a c++ keyword?
a) atoll
b) volatile
c) bool
d) kbhit