Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. What are the final values of x and y after the following statements are executed? x = 5; y = 10; y =
1. What are the final values of x and y after the following statements are executed? x = 5; y = 10; y = x; x y y *- 2; 2. What are the final values of x and y after the following statements are executed? x= y = 2; y x: x = y; 3. What is the output of the following code segment? int i = 0; do { } i=i+25; while (i > 50); cout < < 1 + 50; 4. What will be printed in the following C++ code segment? int i = 1; while (i= 100) ( cout
Step by Step Solution
★★★★★
3.32 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
1 Lets break down the code step by step x 5 x is assigned the value 5 y 10 y is assigned the value 10 y x This is equivalent to y y x so y becomes 10 5 which is 5 x y This is equivalent to x x y so x becomes 5 5 which is 0 y 2 This is equivalent to y y 2 so y becomes 5 2 which is 10 After executing these statements the final values of x and y are x is 0 y is 10 2 Lets break down the code step by step x 1 x is assigned the value 1 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started