Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


swap 2 variables without using 3 rd variable???

Answers were Sorted based on User's Feedback



swap 2 variables without using 3 rd variable???..

Answer / rajendra

let
A=10
B=20
after swaping A=20
B=10
ok
A = A + B (A = 20+10 = 30)
B = A - B (B = 20-10 = 10)---->B=10
A = A - B (A = 30-10 = 20)---->A=20
Thats all very simple

byee Friends
rajendra
rajendra prasad reddy
rajendra_penumalli@yahoo.com
9885162742
hyd

Is This Answer Correct ?    9 Yes 3 No

swap 2 variables without using 3 rd variable???..

Answer / david

a^=b
b^=a
a^=b

Is This Answer Correct ?    1 Yes 1 No

swap 2 variables without using 3 rd variable???..

Answer / guest

Ex:
1.
A=20,B=10
A=A-B=20-10=10
B=A+B=10+10=20
A=B-A=20-10=10

2.
A=6,B=4
A=A-B=6-4=2
B=A+B=2+4=6
A=B-A=6-2=4

The above logic works if A>B. If B>A:

B=6, A=4
B=B-A=6-4=2
A=A+B=4+2=6
B=A-B=6-2=4

Is This Answer Correct ?    0 Yes 0 No

swap 2 variables without using 3 rd variable???..

Answer / padma

Manual testing can be carried out using data validation and
data verification techniques as the function or piece of
code is entirely based on the variables.

Is This Answer Correct ?    0 Yes 0 No

swap 2 variables without using 3 rd variable???..

Answer / padmas

In The Manual Testing process, The team/member is not allowed to do any kind of code/unit or piece of code modifications. etc...,even though the members are aware of bug/ defect exists in the unit/code. Because the question falls under manual testing and even though I know how to do it, it is not out of the box question.

Is This Answer Correct ?    0 Yes 0 No

swap 2 variables without using 3 rd variable???..

Answer / gm

Before Swaping
A = 10
B = 20
After Swapping
A = 20
B = 10

Solution:
B = B - A =(20-10) = 10 ---> B = 10
A = A + B =(10+10) = 20 ---> A = 20 (since B = 10 now)

Is This Answer Correct ?    2 Yes 3 No

swap 2 variables without using 3 rd variable???..

Answer / viji

you can go swap function
swap(a,b)

Is This Answer Correct ?    0 Yes 1 No

swap 2 variables without using 3 rd variable???..

Answer / naresh

rajendra is correct

but the example he took is wrong...

Is This Answer Correct ?    0 Yes 2 No

swap 2 variables without using 3 rd variable???..

Answer / hari

sorry your question is wrong

Is This Answer Correct ?    0 Yes 3 No

swap 2 variables without using 3 rd variable???..

Answer / manu

sorry rejendra but i think u r wrong
u hae initially takn a=10 and b=20
ut had taken opposite values moreovr when u have performed
the operation a=a+b
now the value of a has become 30 not the previous 1
i think this will be done with the use of temp variable

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More Manual Testing Interview Questions

What is functional Testing ?

3 Answers   IBM, UST,


How to write test cases for nevigating menus? Ex. Course -Topics -Subtopics

0 Answers   IBM,


Is the regression testing can call it as Retest

7 Answers   Wipro,


Anyone tell me the test cases of Shopping Favorite

0 Answers   ABI,


How u will test the volume testing in white box testing?

1 Answers  


what is application server, Database server and test server

0 Answers  


Which of these techniques is not useful for partition testing at the class level Option 1 attribute-based partitioning Option 2 category-based partitioning Option 3 equivalence class partitioning Option 4 state-based partitioning

1 Answers   IG, Wipro,


4.How would you define QA/QC?

19 Answers   Nicholas Piramal, VJIL Consulting,


can any one explain the performance testing in detail plz

1 Answers  


Maximum how many defects found in a single module?

2 Answers  


What is difference between web application and non-web applications?

2 Answers  


How many test scripts can you prepare per a day?

5 Answers   AppLabs,


Categories