© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu

C and C++ Interview Questions

18.How we swap two integer values using bitwise operator?

Ans:
a=5
b=10
a^=b^=a^=b.

Ex - 1: What is the output?

#include<stdio.h>
void main()
{
int I=65,j=0;
for(;j<26; i++,j++){
printf("%s\n", i);
}
}
a)compilation Error
b)prints A to Z
c)prints a to z
d)runtime error
Ans: b

Ex - 2: What is the output?
#include<stdio.h>
void main()
{
unsigned int i=-1;
printf("%d\n",i);
printf("%u\n",i*-1);
}
a)runtime error
b)compilation error
c)prints -1 to 1
d)prints 1 and 1
Ans: c

Ex - 3: What will be printed as the result of the operation below:
main()
{
int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf(“%d%dn”,x,y);
}
Ans: 5794


SLogix Student Projects
bottom