References to Chapter 3 CIST1305
Home > Flashcards > Print Preview
The flashcards below were created by user
on FreezingBlue Flashcards
. What would you like to do?
Selection Structure (If-Then-Else structure)
(sometimes called a decision structure) is one of the basic structures you learned about in Chapter 2. You use a selection structure when a program's logic should take one of two paths based on a decision. This selection structure is also called an if-then-else structure because of the language used when describing it.
an expression whose value can be only true or false. True/False evaluation is "natural" from a computer's standpoint, because computer circuitry consists of two-state on-off switches, often represented by 1 or 0. Every computer decision yields a true-or-false, yes-or-no-, 1-or-0 result.
was a mathematician who lived from 1815 to 1864. He approached logic more simply than his predecessors did, by expressing logical selections with common algebraic symbols. He is considered the founder of mathematical logic, and Boolean (true/false) expressions are named for him.
When different actions occur based on the tested Boolean value.
If using a company flow chart, use class for the typical stated name. The use comments // and Declarations which then follows string name and the multiple names that is asking for.
Then input name, and the requested information.
Means one is "on top of" and completely separate from the other.
Six types of Relational Comparison Operators are available in all modern programming languages
The term relational comparison operators is somewhat redundant. You also can call these operators relational operators or comparison operators.
= Equivalency operator
Evaluates as true when operands are equivalent. Many languages use a double equal sign (==) to avoid confusion with the assignment operator.
> Greater-than operator
Evaluates as true when the left operand is greater than the right operand.
< Less-than operator
Evaluates as true when the left operand is less than the right operand.
>= Greater-than or equal-to operator
Evaluates as true when the left operand is greater than or equivalent to the right operand.
<= Less-than or equal-to operator
Evaluates as true when the left operand is less than or equivalent to the right operand.
<> Not-equal-to operator
Evaluates as true when its operands are not equivalent. Some languages use an exclamation point followed by an equal sign to indicate not equal to. (!=)
Trivial Expressions (20 < 20 or30 < 40)
Each will always evaluate to the same result. (False for 20 <20 and true for 30 < 40)
Used to reverse the meaning of the Boolean expression, but you use it in front of a single-expression. The NOT operator is unary instead of binary--that is, you do not use it between two expressions, but you use it in front of a single expression.
When you ask multiple questions before an outcome is determined.
a decision in which more than one condition must be true for an action to take place.
An AND decision can be constructed using a nested decision ( also called a nested selection or a nested if). A nested decision contains a decision "inside of" another decision.
Range of Values
is any series of contiguous values that fall between specified limits.
When you use a range check, you compare a variable to a series of values that mark the limiting ends of ranges. To perform a range check, make comparisons using either the lowest or highest value in each range of values.
Techniques to use to avoid confusion when mixing AND and OR operators
- *You can use parentheses for clarity even though they do not change what the order of operations would be without them.
- * You can use parentheses to override the default order of operations, as in the movie discount example.
- *You can use nesting if statements instead of combining AND and OR operators in a single expression.
What would you like to do?
Home > Flashcards > Print Preview