CMP Ch.4 - Chapter 4 1. In an if/else if statement, the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 4 1. In an if/else if statement, the conditions are tested until one is found to be true. The conditionally executed statement(s) are executed and the program exits the if/else if statement. In a series of if statements, all of the if statements execute and test their conditions because they are not connected. 2. The trailing else provides code that is executed when none of the conditions in the if/else if statement are true. 3. A flag is a Boolean variable signaling that some condition exists in the program. When the flag is set to false it indicates the condition does not yet exist. When the flag is set to true it indicates that the condition does exist. 4. Yes. The if statement can test any value that yields a Boolean value ( true or false ) or a numeric value. When testing a numeric expression, a nonzero numeric value is considered true , and the value 0 is considered false . 5. It takes two expressions as operands and creates a single expression that is true
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/03/2010 for the course CMPSC 121 taught by Professor Crawford,georgew during the Spring '07 term at Pennsylvania State University, University Park.

Page1 / 3

CMP Ch.4 - Chapter 4 1. In an if/else if statement, the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online