Nbsphand tracing table please complete the follow hand


Hand Tracing Table: Please complete the follow Hand Trace Tables. Using MS Word insert the table with proper numbers of columns and table header, below the "Hand Tracing Table Goes Here:" (2 points each, 8 points total).

1. Hand-trace the following code, showing the value of n and the output.

int n = 5;

while (n >= 0)

{

            n--;

            cout<< n;

}

Hand Tracing Table Goes Here:

2. Hand-trace the following code, showing the value of n and the output. What potential error do you notice?

int n = 1;

while (n <= 3)

{

            cout<< n << " ";

            n++;

}

Hand Tracing Table Goes Here:

3. Hand-trace the following code, assuming that a is 2 and n is 4. Then explain what the code does for arbitrary values of a and n.

int r = 1;

inti = 1;

while (i<= n)

{

            r = r * a;

            i ++;

}

Hand Tracing Table Goes Here:

4. Trace the following code. What error do you observe?

int n = 1;

while (n != 50)

{

            cout<< n;

            n = n + 10;

}

Hand Tracing Table Goes Here:

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Nbsphand tracing table please complete the follow hand
Reference No:- TGS01139574

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)