SOWPL&D 4

Ace your homework & exams now with Quizwiz!

4.1 What is a control structure?

4.1 A logical design that controls the order in which a set of statements execute.

4.10 When you write an If-Then-Else statement, under what circumstances do the statements that appear between Else and End If execute?

4.10 When the condition is false

4.5 What types of relationships between values can you test with relational operators?

4.5 You can determine whether one value is greater than, less than, greater than or equal to, less than or equal to, equal to, or not equal to another value.

4.7 Write a pseudocode If-Then statement that assigns 0.2 to commission if sales is greater than or equal to 10,000.

4.7

4.8 How does a dual alternative decision structure work?

4.8 A dual alternative decision structure has two possible paths of execution—one path is taken if a condition is true, and the other path is taken if the condition is false.

4.9 What statement do you use in pseudocode to write a dual alternative decision structure?

4.9 If-Then-Else

Explain what is meant by the term conditionally executed.

A action is performed only when a certain condition is true.

A single alternative decision structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

A single alternative decision provides only one alternative path to execution. Otherwise we exit the structure.

A(n) __________ expression has a value of either true or false.

Boolean

What is a flag and how does it work?

Boolean variables are most commonly used as flags. A Flag is a variable that signals when some condition exists in the program

Briefly describe how the AND operator works.

Both have to be true

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

Compound Boolean

You can write any program using only sequence structures.

False

A program can be made of only one type of control structure. You cannot combine Structures.

False, Structures can be combined within a program.

You use a(n) __________ statement in pseudocode to write a single alternative decision structure.

If-then

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?

If-then-else

You use a(n) __________ statement in pseudocode to write a dual alternative decision structure.

If-then-else

A decision structure can be nested inside another decision structure.

TRUE

A compound Boolean expression created with the __________ operator is true only if both of its subexpressions are true.

and

The symbols >, <, and == are all __________ operators.

conditional

A __________ structure can execute a set of statements only under certain Circumstances.

decision

In pseudocode, the If-Then statement is an example of a __________.

decision structure

A(n) __________ section of a Select Case statement is branched to if none of the case values match the expression listed after the Select statement.

default

A(n) __________ structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.

dual alternative decision

A __________ is a Boolean variable that signals when some condition exists in the Program.

flag

AND, OR, and NOT are __________ operators.

logical

A __________ structure allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to Execute.

multiple alternative decision

If you need to 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?

multiple alternative decision stucture

The __________ operator takes a Boolean expression as its operand and reverses its logical value.

not

Briefly describe how the OR operator works.

one has to be true

A compound Boolean expression created with the __________ operator is true if either of its subexpressions is true.

or

A __________ structure provides one alternative path of execution.

single alternative decision

A compound Boolean expression created with the AND operator is true only when both subexpressions are true.

true

4.4 What is a Boolean expression?

4.4 An expression that can be evaluated as either true or false.

How does a dual alternative decision structure work?

4.13 A dual alternative decision structure has two possible paths of execution—one path is taken if a condition is true, and the other path is taken if the condition is false.

4.14 What statement do you use in pseudocode to write a dual alternative decision Structure?

4.14 If-Then-Else

4.15 When you write an If-Then-Else statement, under what circumstances do the statements that appear between the Else clause and the End If clause Execute?

4.15 If the condition is false.

4.17 What is a multiple alternative decision structure?

4.17 A structure that tests the value of a variable or an expression and then use that value to determine which statement or set of statements to execute.

4.18 How do you write a multiple alternative decision structure in pseudocode?

4.18 With a Select Case statement.

4.19 What does the case structure test, in order to determine which set of statements to execute?

4.19 A variable or an expression

4.2 What is a decision structure?

4.2 It is a program structure that can execute a set of statements only under certain circumstances.

4.20 You need to write a multiple alternative decision structure, but the language you are using will not allow you to perform the test you need in a Select Case statement. What can you do to achieve the same results?

4.20 In such an event, you can use the If-Then-Else If statement, or a nested decision structure.

What is a compound Boolean expression?

4.21 It is an expression that is created by using a logical operator to combine two Boolean subexpressions.

Explain how short-circuit evaluation works with the AND and OR operators.

4.24 The AND operator: If the expression on the left side of the AND operator is false, the expression on the right side will not be checked. The OR operator: If the expression on the left side of the OR operator is true, the expression on the right side will not be checked.

What values can you store in a Boolean variable?

4.27 true or false

What is a flag variable?

4.28 A variable that signals when some condition exists in the program.

4.3 What is a single alternative decision structure?

4.3 A decision structure that provides a single alternative path of execution. If the condition that is being tested is true, the program takes the alternative path.


Related study sets

Anterior compartment (leg): common A=dorsiflexion (DF)/ N=deep peroneal and Dorsal Muscles of Foot

View Set

MUS 150 - Elements of Music Smartbook

View Set

Natural Disasters (Fill In The Blank)

View Set