Wednesday, October 26, 2011

Summary

(a) There are three ways for taking decisions in a program. First way is to use the if-else statement, second way is to use theconditional operators and third way is to use the switch statement.

(b) The default scope of the if statement is only the next statement. So, to execute more than one statement they must be written in a pair of braces.

(c) An if block need not always be associated with an else block. However, an else block is always associated with an if statement.

(d) If the outcome of an if-else ladder is only one of two answers then the ladder should be replaced either with an else-if clause or by logical operators.

(e) && and || are binary operators, whereas, ! is a unary operator.

 (f) In C every test expression is evaluated in terms of zero and non-zero values. A zero value is considered to be false and a non-zero value is considered to be true.

(g) Assignment statements used with conditional operators must be enclosed within a pair of parenthesis.

No comments:

Post a Comment