Preview

Unit 5 PT1420

Good Essays
Open Document
Open Document
959 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Unit 5 PT1420
. Explain what is meant by the term “conditionally executed”.

Conditionally executed is called a single alternative decision structure because it provides only one alternative path of execution. The action is conditionally executed because it is performed only when a certain condition is true.

2. You need to test a condition and then execute one set of statements if the condition is true. If the condition is false, you need to execute a different set of statements. What structure will you use?

I will use the “If” statement because it is a dual alternative decision structure.

3. If you need to a test the value of a variable and use that value to determine which statement or set of statements to execute, which structure would be the most straightforward to use?

The case structure lets the value of a variable or an expression determine which path of execution the program will take.

4. Briefly describe how the AND operator works.

The AND operator takes two Boolean expressions as operands and creates a compound Boolean expression that is True only when both sub-expressions are true.

5. Briefly describe how the OR operator works.

The OR operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the sub-expressions is true. The following is an example of an If-Then statement that uses the OR operator:

6.When determining whether a number is inside a range, which logical operator is it best to use?

The AND operator would be the best to use to determine whether or not a number is within a given range.

7. What is a flag and how does it work?

A flag is a Boolean variable that signals when some condition exists in the program. When the flag is set to False, it indicates the condition does not exist. When the flag variable is set to True, it means the condition does exist.

Algorithm Workbench

1. Design an If-Then statement (or a flowchart with a

You May Also Find These Documents Helpful

Related Topics