1. Question:When is a switch statement better than multiple if statements? 

    Answer
    A switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type.

    1. Report
  2. Question:What are control structures? 

    Answer
    Control structures take charge at which instructions are to be performed in a program. This means that program flow may not necessarily move from one statement to the next one, but rather some alternative portions may need to be pass into or bypassed from, depending on the outcome of the conditional statements.

    1. Report
  3. Question:When is a “switch” statement preferable over an “if” statement? 

    Answer
    The switch statement is best used when dealing with selections based on a single variable or expression. However, switch statements can only evaluate integer and character data types.

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd