IF ELSE IF LADDER STATEMENT Flashcards
The 1. _______ ladder is a sequence of if conditions that check various possibilities in a 2._______. It’s useful when you have 3.______ to check.
- if-else-if
2.cascading manner
3.more than two possibilities
Test Expression 1:
The program starts by evaluating the 1._______
If 2.____, it 3.______ Statement 1 and 4.____
If 4._____, it moves to the 6._____.
1.first condition.
2.true
3.executes
4.exits the ladder.
5.false
6.next condition
Test Expression 2:
If the 1.______ was 2.____, this condition is 3._____.
If 4.______, it 5._________ and 6.____.• If 7.____, it moves to the 8.______.
1.first condition
2.false
3.evaluated
4.true
5.executes Statement 2
6.exits the ladder
7.false
8.next condition
Test Expression 3:
If the 1.________ were 2.____, this condition is 3.____.
If 4._____, it 5.______ and 6._____.
If 7._______, it moves to the 8.______.
1.first two conditions
2.false
3.evaluated
4.true
5.executes Statement 3
6.exits the ladder
7.False
8.Body of else
Body of else:
If 1.___ of the previous conditions were 2.____, the code within this block is executed.
Statement just below 3.____
Regardless of which condition was 4.______,this statement is always 5.____.
1.none
2.true
3.if-else-if
4.true or false
5.executed
It ensures that only 4._______________, the one corresponding to the 5.________.
If 6._________, the code in the 7._________.
4.one block of code is executed
5.first true condition
6.none of the conditions are true
7.else block is executed
The 1._____ is a 2._____ for 3._______ in programming.
It’s important to order the conditions 4.______ to ensure the 5.________ is executed.
The else block is 6._____, but it’s often used to 7.______ where none of the conditions are met.
1.if-else-if ladder
2.versatile tool
3.making decisions
4.logically
5.correct block of code
6.optional
7.handle cases
A 1.______ means placing an 2.________. This is used when you need to 3.________ in layers. For example, you might check an initial condition, and if it’s true, move deeper into another condition.
1.nested if
2.if statement inside another if
3.test multiple conditions
Outer If Condition
The program starts by evaluating the 1.________.
If the condition is 2._____, the flow moves to the Code 3.______.
If the condition is 4._____, the 5.____ directly moves to the Code after the outer if statement.
1.Outer If Condition
2.true
3.inside the outer if statement
4.false
5.flow
- Inner If Condition:
If the Outer If Condition was true, this inner condition is evaluated.
If the 1.______ is 2.____, the flow reaches the Code 3.________.
If the 4.________ is 5._____, the flow directly moves to the Code 6._________.
1.Inner If Condition
2.true
3.inside the inner if statement
4.Inner If Condition
5.false
6.after the outer if statement
The 4.______ condition acts as the 5._________.
If the 6.________ is 7._____, a 8.______ condition is evaluated to determine the next course of action.
If either the outer or inner condition is 9.___, the program moves to the 10._________.
4.outer if
5.primary decision point
6.outer condition
7.true
8.nested if
9.false
10.final block of code
You can nest multiple if statements within each other to create ___________.
complex decision-making structures
1._____ helps in 2.______ the nesting levels and makes the code more 3._____.
1.Indentation
2.visualizing
3.readable
Use 1._____ and 2.______ variable names to improve code understanding.
1.clear
2.descriptive
Consider using 1._______ (&&, ||, !) to 2.______ within if statements.
1.logical operators
2.combine conditions