Control Instructions - Point Out Errors :: Discussion


1.Point out the error, if any in the for loop.
A.There should be a condition in the for loop
B.The two semicolons should be dropped
C.The for loop should be replaced with while loop.
D.No error
Answer:  Option  D
Explanation:

Step 1for(;;) this statement will genereate infinite loop.
Step 2printf("%d\n", i++); this statement will print the value of variable i and increement i by 1(one).
Step 3if(i>10) here, if the variable i value is greater than 10, then the for loop breaks.

Tutorial Link:
Published by:Michael Daani

Comments are not available

Post your comments here:

Optional

Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers