Intro to Programming Chapter 3

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

True

Comparing two amounts in order to decide if they are not equal to each other is the most confusing of all the comparisons.

if-then-else

The selection structure where the logic can flow only to one of the two alternatives, never to both is called a(n) ____ structure.

True

When new programmers perform range checks, they are prone to using logic that includes too many decisions, entailing more work than is necessary.

prompt

A ____ is a displayed statement that advises a user what to do. For example, "Please enter your name."

compound condition

A ____ is created when you need to ask multiple questions before an outcome is determined.

Boolean expression

A ____ is one that represents only one of two states, true or false.

range

A ____ of values is every value between low and high limits.

cascading

A series of nested if statements is also called a ____ if statement.

operand

A(n) ____ is a value on either side of an operator.

dead

A(n) ________ or unreachable path is a logical path that can never be traveled.

equal to, greater than, and less than

Any decision can be made using combinations of just three types of comparisons: _____.

False

Boolean (true/false) expressions are named for George Boolean.

||

C#, C++, C, and Java use the symbol ____ to represent the logical OR.

short-circuit

Each part of an expression that uses an AND operator is evaluated only as far as necessary to determine whether the entire expression is true or false, this feature is called ____ evaluation.

True

Every decision you make in a computer program involves evaluating a Boolean expression.

X <= Y

If X > Y is false, which of the following is always true?

X AND Y OR Z

If X is true, Y is true, and Z is false, which of the following expressions is true?

exclamation point

In C++, Java, and C#, the ____ is the symbol used for the NOT operator.

true

In an AND decision, it is more efficient to first ask the question that is less likely to be ____.

True

In an OR decision, it is more efficient to first ask the question that is more likely to be ____.

constants

In any Boolean expression, the two values compared can be either variables or ____.

False

In every programming language, addition has precedence over multiplication in an arithmetic statement.

parentheses

Many programming languages allow you to use ____ to correct your logic when using ANDs and ORs and force the OR expression to be evaluated first.

True

Most programming languages allow you to combine as many AND and OR operators in an expression as you need.

OR

Sometimes you want to take action when one or the other of two conditions is true, this type of compound condition is called a(n) ____ decision.

False

String value: "BLACK HORSE" is equal to "Black Horse".

double

The YumYum store sells ice cream. Single-scoops cost $2.00, double-scoops cost $2.80, and triple-scoops cost $3.50. Double-scoop orders account for about 50 percent of the sales; single-scoop orders account for 30 percent and only 20 percent of sales are triple-scoops. When you write a program to determine sales based on scoop size, you can make the most efficient decision by asking first whether the scoop size is ____.

AND

The YumYum store sells ice cream. Single-scoops cost $2.00, double-scoops cost $2.80, and triple-scoops cost $3.50. No matter how many scoops a customer chooses, when a customer also decides that they want the ice cream served in a cone, there is an additonal 50 cent charge. In order to correctly charge for the ice cream served in a cone, you would use a(n) ____.

$100 dollars of sales

The YumYum store sells ice cream. Single-scoops cost $2.00, double-scoops cost $2.80, and triple-scoops cost $3.50. There is a $10 bonus for ice cream store workers that have more than $100 of sales on their shift and sell more than four triple-scoop servings. During any one shift, there are many more workers selling more than four triple-scoop servings than workers having more than $100 in sales. When you write a program to determine bonuses, you can make the most efficient decision by first asking if workers had more than ____.

if Sales > 100 AND tripleScoop > 4

The YumYum store sells ice cream. Single-scoops cost $2.00, double-scoops cost $2.80, and triple-scoops cost $3.50. There is a $10 bonus for ice cream store workers that have more than $100 of sales on their shift and sell more than four triple-scoop servings. What pseudocode will select the workers that will earn a bonus?

nested if statements using OR logic

The YumYum store sells ice cream. Single-scoops cost $2.00, double-scoops cost $2.80, and triple-scoops cost $3.50. To most efficiently keep track of the sales for each of the three serving sizes, you would use ____.

<=

The ____ operator evaluates as true when the left operand is less than or equivalent to the right operand.

&&

The conditional AND operator in Java, C++, and C# consists of ____.

six

There are ____ relational comparison operators supported by all modern programming languages.

True

Trivial expressions will always evaluate to the same result.

1 or 0

True/false evaluation is "natural" from a computer's standpoint because computer circuitry consists of two-state on-off switches, often represented by ____.

case

When several decisions are based on the value of the same variable, many programming languages offer a shortcut called the ____ structure.

precedence

When you combine AND and OR operators, the AND operators take ____, meaning their Boolean values are evaluated first.

range

When you use a(n) ____ check, you compare a variable to a series of values that mark the limiting ends of ranges.

True

When you use an AND operator to join multiple Boolean expressions, all the individual expressions must be true for the joint expression to be true.

False

When you use the OR operator, both of the listed conditions must be met for the resulting action to take place.

if age > 21 then

Which of the following pseudocode selects all people over 21?

if a > 10 AND b > 10 then output "OK"

Which of the lettered choices is equivalent to the following decision? if a > 10 then if b > 10 then output "OK" endif endif

NOT

You use the logical ____ operator to reverse the meaning of a Boolean expression.

Truth tables

____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.


Kaugnay na mga set ng pag-aaral

Phil2033- Prof. Harding HW Questions 3a-4d

View Set

Communication in Nursing: Exam 1

View Set

Chapter 11 Select all that apply

View Set

Vocabulary Workshop Level C - Unit 7

View Set

Chapter 3: Structure and Function of the Reproductive System

View Set