Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following two lines of code for the first two questions: int n=10;

ID: 3767720 • Letter: C

Question

Consider the following two lines of code for the first two questions: int n=10; while(n++); How many times will the test in the null while loop be performed before control drops on down to the code (not shown) directly below the while statement? Explain. What will be the value of n at the time the statement (not shown) following the while is ready to execute? Explain. Write the line of code that will declare a table (an array in ROM) that has the following 5 values, in the order given: -200, 58,101,'Axfa. Make the elements as small as possible, but capable of holding each of the above 5 values. I low many bytes of ROM does it use? Declare the 16-bit unsigned variables named m and n and a pointer to that type of value named p. Initialize m to 25000. ii to 65000. and p to point to m. Do this with a single statement.

Explanation / Answer

Answer:

1.

The loop executes for 10 times from -9 to 0. The loop stops at 0 because, the value 0 represents the boolean value false. So, the loop terminates when the value of n is 0.

2.

The value of n at which the while loop starts its execution is -9. This is because the value pre-increments before execution. So, -10+1=-9.

5.

m=25000,n=65000,*p=&m;

Given, p is pointed to m. So, p is a pointer of m.