Question

USE THE TABLE AND OUTPUT TECHNIQUE FOR THIS 8 POINT PROBLEM What is the output from the following SEGMENT: note TYPES OF PARA
IV: (5 pts) consider following program segment show the memory snapshot of each member of the array, le. What are the values
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

now X and C are globale variabales

And X=4, C=2

Now A ,B, and W are local varibales

A=4, B=3

Now in test function first parameter is passed by references

At starting values of all the variables are:

X   C   A    B
4   2   4   3

now calling test function with A and B be sure A passed as references

so In function Y=4 and Z=3

Now X = X + Z
So   X = 4 + 3
   X = 7
  
Now Y = C + Z
so Y = 2 + 3
   Y = 5

And return Z so return 3

Now here Y passed as references So A's value chage to 5
B remains same 3
W = 3

So after Test function

X   C   A    B W
7 2 5 3 3

So output is

A = 5 B = 3
X = 7 C = 2
W = 3

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
  

Add a comment
Know the answer?
Add Answer to:
USE THE TABLE AND OUTPUT TECHNIQUE FOR THIS 8 POINT PROBLEM What is the output from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Examine each of the following program segments carefully. Determine what is printed from each program. There...

    Examine each of the following program segments carefully. Determine what is printed from each program. There are no intentional errors. 1. int array[] = {1, 2, 3, 4, 5}; for (int i = 0; i < 5; i++) cout << array[i]*5 << “ “; Output _________________________________ 2. int *iptr; iptr = new int[5]; for (int count = 0; count < 5; count++) iptr[count] = count+1; cout << *iptr << endl; Output _________________________________ 3. int x = 50, y = 60,...

  • Flow CHART READ THIS PROGRAM OVER SEVERAL TIMES vI: Flow chart the problem that follows. DO...

    Flow CHART READ THIS PROGRAM OVER SEVERAL TIMES vI: Flow chart the problem that follows. DO NOT WRITE THE CODE. Your grade will depend on how well you show cosmology the behavior of space through time is given by a function called the scale factor r(t). The variable,t, i behaviors of the scale factor depending upon estimates of the amount of matter in the universe. The amount of rogrom will start by asking the user for the epsilon value only...

  • 18 C++ 1. What is the output of the following program segment? int y-22: while ((y...

    18 C++ 1. What is the output of the following program segment? int y-22: while ((y 3) != 0) cout << y<< "": y=y-2; The output is 2. Suppose that the input is 100, 20,-8, 50, 20. What is the output of the following C++ code? int sum0 int num: int j cin >> num: if (num < 0) continue зит зит + num; cout<< sum << endl; The output is

  • a) Hand-trace the following program and determine and write down what is the output of the...

    a) Hand-trace the following program and determine and write down what is the output of the code.                b) Run the code and compare the program output to your hand-traced result obtained from part (a). #include <iostream> #include <iomanip> using namespace std; void f(); int x = 5; int main() {         cout << "x = " << x << endl;         int x = 6;         cout << "x = " << x << endl;         {                int...

  • C++ What is the output of the following program? Using a pointer diagram show the evolution...

    C++ What is the output of the following program? Using a pointer diagram show the evolution of all data objects in memory. Assume the code is embedded in a correct and complete program. 3.(8 pts) What is the output of the following program? Using a pointer diagram show the evolution of all data objects in memory. Assume the code is embedded in a correct and complete program. int array size 4, *a i a new int [array size] int *p...

  • C++ output 6) What is the exact output of the following program? #include <iostream> using namespace...

    C++ output 6) What is the exact output of the following program? #include <iostream> using namespace stdi void zolo(int &a, int sb) int main int x = 5, y =8; zolo(x,y)i cout << "x " << x << endl ; cout << "y = "" << y << endl ; return o: void zolo(int &a, int &b) int v1 = b + a; ' int v2 = b-a; 3 a=v1;13

  • howthe   output   of   the   following   4   program segments (a)    const int SIZE=8;    int values[SIZE]...

    howthe   output   of   the   following   4   program segments (a)    const int SIZE=8;    int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8};    int index;    index=0;    res = values[index];    for (int j=1; j<SIZE; j++)    {        if (values[j] > res)        {            res = values[j];            index = j;        cout << index << res << endl;        }    }    cout <<...

  • What is the output from each of the following segments of C++ code? Record the output...

    What is the output from each of the following segments of C++ code? Record the output after the “Answer” prompt at the end of each program fragment. Assume all variables have been suitably declared. (Each problem is worth 3 points.) 1. for (int j = 25; j > 16; j -= 3)        cout << setw(5) << j;     Answer: 2. int sum = 0;       for (int k = -2; k <= 2; k++)         sum = sum +...

  • What is the output of the following program? int main(void) { int x, y, z; x...

    What is the output of the following program? int main(void) { int x, y, z; x = 5; y= test(x); z= x + y; cout<< setw(4)<<x <<” + “<<setw(4)<<y<<”=” << setw(4)<<z<<endl; return 0; } int test (int x) { int w; w = x + 10; return (w); }

  • C++ problem with dynamic arrays is that once the array is created using the new operator...

    C++ problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector. This project asks you to create a class called DynamicStringArray that includes member functions that allow it to emulate the behavior of a vector of strings. The class should have: A private member variable called dynamicArray that references a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT