Loop control expression

Assume that the following code is correctly inserted into a program:  (4) 

int num = 1;

int count;

for (count = 0; count < 5;=””>

    num = 2 * num + num % (count + 1);

a. What is the final value of num? 

(i) 15                      (ii) 42                     (iii) 26                    (iv) none of these

b. If a semicolon is inserted after the right parentheses in the for loop statement, what is the final value of num? 

(i) 1                        (ii) 2                       (iii) 3                      (iv) 4                      (v) none of these

c. If 5 is replaced with 0 in the for loop control expression, what is the final value of num? 

(i) 0                        (ii) 1                       (iii) 2                      (iv) none of these

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X