Which of the following if statements correctly evaluates for
Which of the following if statements, correctly evaluates for whether a variable\'s value, called valueA, is less or equal than valueB\'s value, and, either valueC is bigger than 3 or valueD is equal to the word \"smurf\".
A. if( valueA < valueB && ( valueC > 3 || valueD == \"smurf\") )
B. if( valueA <= valueB && ( valueC > 3 || valueD == \"smurf\") )
C. if( valueA <= valueB || ( valueC > 3 && valueD == \'smurf\') )
D. if( valueA <= valueB && ( valueC > 3 || valueD = \'smurf\') )
Solution
Answer :
Which of the following if statements, correctly evaluates for whether a variable\'s value, called valueA, is less or equal than valueB\'s value, and, either valueC is bigger than 3 or valueD is equal to the word \"smurf\".
A. if( valueA < valueB && ( valueC > 3 || valueD == \"smurf\") )
B. if( valueA <= valueB && ( valueC > 3 || valueD == \"smurf\") )
C. if( valueA <= valueB || ( valueC > 3 && valueD == \'smurf\') )
D. if( valueA <= valueB && ( valueC > 3 || valueD = \'smurf\') )
Answer :
B. if( valueA <= valueB && ( valueC > 3 || valueD == \"smurf\") )
Explanation :
valueA, is less or equal than valueB\'s value
ValueA <= ValueB
valueC is bigger than 3 or valueD is equal to the word \"smurf\".
ValueC > 3 || ValueD==\"smurf\"
If Statement :
valueA, is less or equal than valueB\'s value, and, either valueC is bigger than 3 or valueD is equal to the word \"smurf\".
if( valueA <= valueB && ( valueC > 3 || valueD == \"smurf\") )
This is the correct if statement for given statements.
