Kotlin Conditional Statements
Kotlin Conditional Statements - Important Points
1. | Which conditional statement is used to check for a single condition? |
---|
A. if
B. else
C. switch
D. none of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
2. | What is the syntax for the if-else statement? |
---|
A. if (condition) { } else { }
B. if (condition) { } else
C. if { } else { }
D. if (condition) { }
View Answer Discuss Work SpaceAnswer: option a
Explanation:
3. | Which conditional statement is used to check multiple conditions? |
---|
A. if
B. else
C. switch
D. none of the above
View Answer Discuss Work SpaceAnswer: option c
Explanation:
4. | What is the syntax for the switch statement? |
---|
A. switch (expression) { case value: statements; break; default: statements; }
B. switch (expression) { case value: statements; break; default: }
C. switch (expression) { case value: statements; default: statements; }
D. switch (expression) { case value: statements; default: }
View Answer Discuss Work SpaceAnswer: option a
Explanation:
5. | What is the purpose of the "else" statement? |
---|
A. To check multiple conditions.
B. To execute a block of code if the "if" condition is true.
C. To execute a block of code if the "if" condition is false.
D. None of the above.
View Answer Discuss Work SpaceAnswer: option c
Explanation: