Interview Questions And Answers

Q: - How do you choose between if/else and switch?

If more than just one or two else clauses are used, and all are testing the same value, consider using a switch statement.

C++ used for:

C++ is a powerful general-purpose programming language. It can be used to create small programs or large applications

Submitted By:-Nazir            Email-ID: - bbenazir44@yahoo.com

Q: - How do you choose between while and do...while?

If the body of the loop should always execute at least once, consider a do...while loop; otherwise, try to use the while loop.


Submitted By:-Nazir            Email-ID: - bbenazir44@yahoo.com

Q: - How do you choose between while and for?

If you are initializing a counting variable, testing that variable, and incrementing it each time through the loop, consider the for loop. If your variable is already initialized and is not incremented on each loop, a while loop may be the better choice.

Submitted By:-David            Email-ID: - David_Willa121@yahoo.com