TBD Exam Questions & Answers 2024/2025
TBD Exam Questions & Answers 2024/2025 Describe the difference between the if/else if statement and a series of if statement.s - ANSWERSIn an if/else if statement, the conditions are tested until one is found to be true. The conditionally executed statement(s) are executed and the program exits the if/else if statement. In a series of if statements, all of the if statements execute and test their conditions because they are not connected. In an if/else if statement, what is the purpose of a trailing else? - ANSWERSThe is/else if statement is used to verify a sequence of situations. If a code has several conditional expressions with if/else if statement, the code verifies the first conditions and executes that block only if the first condition is true. If the first condition is false, it verifies the next conditions and executes that block only if the first condition is true, and so on. At the end of the if/else if statement, the code has an else block without conditional expression, it is called as trailing else. The block of statements under this trailing else is executed when all the preceding conditional expressions are false. What is a flag and how does it work? - ANSWERSA flag is a Boolean variable signaling that some condition exists in the program. When the flag is set to false it indicates the conditions does not yet exist. When the flag is set to true it indicates that the condition does exist. Can an if statement test expressions other than relational expressions? Explain. - ANSWERSYes. An if statement can test expression other than relational expressions. The if statement test the expression that returns the numeric value or Boolean value; that is True (or 1) of False (or 0). In the if statement, if the value of the expression inside the parentheses is true, then the statements in the if-block are executed. If the value of the expression inside the parentheses is false, then the statements in the else-block are executed.
Geschreven voor
- Instelling
- TBD
- Vak
- TBD
Documentinformatie
- Geüpload op
- 22 maart 2024
- Aantal pagina's
- 1
- Geschreven in
- 2023/2024
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
tbd