Swap 2 variables without using a temp variable

Answers were Sorted based on User's Feedback



Swap 2 variables without using a temp variable..

Answer / guest

a,b
a=a+b
b=a-b
a=a-b

Is This Answer Correct ?    21 Yes 0 No

Swap 2 variables without using a temp variable..

Answer / sheetal

if a=5 and b=3 are two variables, then add them i e
a=a+b; a=8
b=a-b; b=5
a=a-b; a=3

Is This Answer Correct ?    12 Yes 0 No

Swap 2 variables without using a temp variable..

Answer / mfsi_satyakamm

int x,y;
x=x+y;
y=x-y;
x=x-y;

Is This Answer Correct ?    12 Yes 1 No

Swap 2 variables without using a temp variable..

Answer / s n

try this one line swaping of two variables


a=((a+b)-(b=a));

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More Manual Testing Interview Questions

What is the difference between Project Based Testing and Product Based Testing?

4 Answers   Scandent,


1. What is Test data? 2. What is Test Development? 3. What is Boundary value & Equilance Partition? 4. What is Compatability testing? 5. How do you know Prepared Test cases are Responsable testcases or not? 6. Give me a Tracebility matrix documet & Deffination? 7. What is Error, Defect, Bug? 8. What is Smoke testing, Monkey testing, Sanity testing? 9. What is defference b/w Functionality testing & Regression testing? Give me a Example? 10. In your exp which type of defects you identify? 11. Tell me a defects for load testing,Security testing? 11. What is defference b/w System testing & User acceptance testing? 12. How many test cases write per a day& for one project how many testcases write you? 13. A professor has introduce some cources in college How to write test case for this requirement? 14. Write a test case for ATM Meachane? 15. Which configuration tool you used in .Net Application & Java based Applications? 16. What is the difference b/w Client server & Web based Application? 17. What is two tier & three tier application?Give me a example? 18. What is the defference b/w Java & J2ee? 19. Which model life cycles you used for Development & Testing? 20. Explain Development & Testing life cycles? 21. How to connect data table from QTP? 22. How QTP recognize Dynamic objects? 22. Which Atomation Frame work can you invoved in QTP& Explain me? 23. How QTP Tool Identify objects? 24 What is the difference b/w Check point & Out put value in QTP? 25. When did you give High Priority & High Seviority High Priority & Low Seviority High Seviority &High Priority High Seviority & Low Seviority?

3 Answers   IBM, Path Finders,


What is common interface?

0 Answers  


what are the real purposes of test cases

2 Answers  


What is Pilot testing ?

2 Answers  






How do you do Analysis and design for testing projects?

1 Answers  


After insert the record in front-end, how will you check the back end by manually? Please explain?

0 Answers  


what is the best defect(functionally relaleted) u find in u r career?

2 Answers  


Explain Boudary value testing and equivalence testing ?

3 Answers   Crea,


What is difference between smoke testing and sanity testing? In simplest manner...

7 Answers  


What is the name of the process developed by The Software Engineering Institute that addresses 18 key process areas for achieving a certain level of organizational maturity?

1 Answers   TCS,


i joined in qutesys company and i didnt know even what is testing how it is possible?

2 Answers  


Categories