| Back to Questions Page |
| Question |
void swap(int a,int b)
{
a=a+b;
b=a-b;
a=a-b;
}
in this code always gives the same result for all case |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Bala |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
NO,if the values of a&b are 10,20 respectively., Then
a=a+b becomes "a=30"
b=a-b becomes b=30-20 i.e., "b=10"
a=a-b gives a=30-10 i.e., "a=20"  |
0 | K.kavitha |
| |
| |
| Answer |
provided a+b is between the int minimum and int maximum
so the answer is no.  |
0 | Mangala Pandi P |
| |
| |
| Answer |
NO
Means we can give diff values give different answer.
like
we can give a=80,b=100
a=180,b=20,a=20  |
0 | Sunny |
| |
| |
|
|
| |
| Answer |
Sorry, it does nott.. :-)
it works proper..  |
0 | Shruti |
| |
| |
| Answer |
no,result will depend on the values of a nd b  |
0 | Sourabh |
| |
| |
| Answer |
Actually this code is for interchanging values of two
variables without using third variable  |
0 | Prateek |
| |
| |
| Question |
12. Look at the Code:
main()
{
int a[]={1,2,3},i;
for(i=0;i<3;i++)
{
printf("%d",*a);
a++;
}
}
Which Statement is/are True w.r.t the above code?
I.Executes Successfully & Prints the contents of the array
II.Gives the Error:Lvalue Required
III.The address of the array should not be changed
IV.None of the Above.
A)Only I B)Only II C)II & III D)IV
|
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Harsha |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
B)only 2  |
0 | Rakesh |
| |
| |
| Answer |
error: wrong type argument to increment  |
0 | Basha |
| |
| |
| Answer |
2  |
0 | Fakkad |
| |
| |
| Answer |
2 gives the error because array name is nothing but a
constant pointer we cannot increment the constant pointer so
it will give error  |
0 | Jaleelbaig |
| |
| |
| Question |
6. Which of the Following is not defined in string.h?
A)strspn()
B)strerror()
C)memchr()
D)strod()
|
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Harsha |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
d, strod is not avaliable  |
0 | Vishnu948923 |
| |
| |
| Question |
what will be the output:
main(){char ch;int a=10;printf("%d",ch);} |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Sandipan |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
ans ch=0
if we print a it wil be 10  |
0 | Reddy |
| |
| |
| Answer |
It'll give a warnin tat "a is never used...If u Continue
executing...it will the memory addres that is currently
used.  |
0 | Paul |
| |
| |
| Answer |
The answer is Garbage value...
The answer willbe lik -113...Depending upon the compailer
If we declare as..
static char ch;
Then Answer is 0.....  |
2 | Bharath S |
| |
| |
| Answer |
it will print 64  |
0 | Ruth |
| |
| |
|
| |
|
Back to Questions Page |