Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Anyone please explain this??? (https://www.warriorforum.com/programming/1099671-anyone-please-explain.html)

kaputchnik 12th August 2015 07:49 AM

Anyone please explain this???
 
Here is a series of three steps:

Step 1: A = 10
Step 2: B = 20
Step 3: A = B

A and B are variables, that is they can stand for any value.
The "=" sign stands for assignment. It means "assign the value on the right to the variable on the left".
After all three steps above have been completed, what are the values of A and B? *
A = 30, B = 0
A = 30, B = 20
A = 20, B = 20
A = 20, B = 0
A = 10, B = 10
A = 10, B = 20
A = 20, B = 10
A = 0, B = 10

The Stardust Traveler 12th August 2015 11:18 AM

Re: Anyone please explain this???
 
A=20
B=20

The variables will be equal to the last number assigned to them.

David Beroff 12th August 2015 06:06 PM

Re: Anyone please explain this???
 
So where do you go to school?

KirkMcD 13th August 2015 04:39 AM

Re: Anyone please explain this???
 
Quote:

Originally Posted by David Beroff (Post 10218604)
So where do you go to school?

If he couldn't figure that out, I don't think he does go to school.

David Beroff 13th August 2015 05:02 AM

Re: Anyone please explain this???
 
Quote:

Originally Posted by KirkMcD (Post 10219250)
If he couldn't figure that out, I don't think he does go to school.

Maybe I was being too subtle. I was trying to imply that he was asking us to do his homework for him.

KirkMcD 13th August 2015 08:53 AM

Re: Anyone please explain this???
 
I think I was a bit more subtle than you, in that I pretty much just called him (and I'm going to be subtle again) not very smart.

PriyaJayaraman 17th August 2015 09:58 PM

Re: Anyone please explain this???
 
Answer is 3rd Option from the given above list. B is getting assigned to A, since assignment operator is used.

smilesumo 22nd August 2015 10:04 AM

Re: Anyone please explain this???
 
A = 30, B = 0 <-- i am pretty sure this would return a syntax error :D

yaser3bed 5th February 2018 10:44 AM

RE: Anyone please explain this???
 
Step 3 made the variable constant
A = 10, B = 20 that is right
yaser abu sh

ruchi chouhan 7th February 2018 06:18 AM

RE: Anyone please explain this???
 
A=20 and B=20


All times are GMT -6. The time now is 04:40 AM.