Questions and Answers
What is the purpose of the 'if-else' structure in programming?
To select between two alternatives based on a condition
In the 'if-else if-else' structure, when does the program execute the 'else' block?
When the condition in the 'else if' block is false
What is the output of Sample Program 1 if the input number is 0?
0 is a negative value
In which scenario does Alternative Program 2 execute the 'else if (number < 0)' block?
Signup and view all the answers
What does the 'if/else ladder' refer to in programming?
Signup and view all the answers
What is the purpose of the 'Selection' control structure in programming?
Signup and view all the answers
What happens if none of the conditional expressions in a chain of if-else statements are true?
Signup and view all the answers
In the given code, what is the value of 'grade' if 'mark' is 75?
Signup and view all the answers
What is the purpose of using logical operators in conditional statements?
Signup and view all the answers
In the alternative comparison code, what is the value of 'grade' if 'mark' is 55?
Signup and view all the answers
What does the 'else' statement represent in a chain of if-else statements?
Signup and view all the answers
What happens if a true condition is found in a chain of if-else statements?
Signup and view all the answers
When are logical operators used in conditional statements?
Signup and view all the answers
What does the final else act as in a chain of if-else statements?
Signup and view all the answers
What are the outcomes of using && as a logical operator?
Signup and view all the answers
What happens if there is no final else and all other conditions are false in a chain of if-else statements?
Signup and view all the answers