Questions and Answers
What is the purpose of the 'if-else' structure in programming?
To execute a statement only if a specified condition is true
Which control structure in programming is used to perform different actions based on different conditions?
Selection
In the given sample program 1, what will be the output if the 'number' entered is 0?
0 is a negative value
What would be the output of the given alternative to sample program 2 if 'number' is 5?
Signup and view all the answers
What does the 'else if' structure allow in programming?
Signup and view all the answers
What is the purpose of the 'Switch' control structure in programming?
Signup and view all the answers
What will happen if no condition is true in a series of else-if statements?
Signup and view all the answers
In the context of multiple else-if statements, what does the final else serve as?
Signup and view all the answers
In the given Java code, what will be the grade if the exam mark is 75?
Signup and view all the answers
What do logical operators allow in a conditional statement?
Signup and view all the answers
In Java, what would be the result of the following logical operation: true && false?
Signup and view all the answers
In Java, what happens when an expression with the || operator has both conditions as false?
Signup and view all the answers
What are the operands of logical operators in Java?
Signup and view all the answers
In Java, what is evaluated first when Java sees a && operator or a || operator?
Signup and view all the answers
If num1 is -2 and num2 is 4, what will be the result of this expression: num1 > 0 && num2 < 0?
Signup and view all the answers
What are logical operators commonly used for in Java?
Signup and view all the answers