Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 2 (Q.No. 14)
14.
In which statements, does a 'continue' statements cause the control to go directly to the test condition and then continue the looping process?
'for' and 'while'
'while' and 'if-else'
'do-while' and 'if-else'
'while' and 'do-while'
None of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
7 comments Page 1 of 1.

Saba said:   3 years ago
Continue; --> The control will be transferred to increment section, then condition checking.

But the question is ". Control to go directly to the test condition".

So, while-loop and do-while-loop is the correct one.

A 'continue' statements cause the control to go directly to the test condition and then continue (continue; --> The control will be transferred to increment section, then condition checking. ) the looping process.

Rex said:   4 years ago
I think the answer is B. In do-While first do the procedure and then check.

If I am wrong, correct me.

Prince said:   1 decade ago
Thank you sundar you explained well.

Suresh said:   1 decade ago
Sundar is correct.

We can use the continue statement in for-loops, nut it will transfer the control to increment section then condition checking not directly to condition checking.

Since the question is "...directly to the test condition...", the given answer is correct.

Vasudevan said:   1 decade ago
Is this correct? I think we can use continue statement in for loop also.

Sundar said:   1 decade ago
In for-loop:

continue; --> The control will be transfered to increment section, then condition checking.

But the question is "...control to go directly to the test condition..."

So, while-loop and do-while-loop is the correct one.

I hope this will help you. Have a nice day!

Himanshu said:   1 decade ago
Whats wrong with 'for-loop'. Give a example please.

Post your comments here:

Your comments will be displayed after verification.