Deck 3: Making Decisions

ملء الشاشة (f)
exit full mode
سؤال
In any Boolean expression,the two values compared can be either variables or ____.

A) numbers
B) nulls
C) constants
D) trivial expressions
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In every programming language,addition has precedence over multiplication in an arithmetic statement.
سؤال
When you use the OR operator,both of the listed conditions must be met for the resulting
action to take place.
سؤال
A ____ is a displayed statement that advises a user what to do.For example,"Please enter your name."

A) start
B) question
C) prompt
D) query
سؤال
Every decision you make in a computer program involves evaluating a Boolean expression.
سؤال
String value: "BLACK HORSE" is equal to "Black Horse".
سؤال
If X > Y is false,which of the following is always true?

A) X < Y
B) X <= Y
C) X = Y
D) X >= Y
سؤال
A ____ is one that represents only one of two states,true or false.

A) Boolean expression
B) short-circuit evaluation
C) trivial expression
D) truth table
سؤال
Boolean (true/false)expressions are named for George Boolean.
سؤال
Most programming languages allow you to combine as many AND and OR operators in an expression as you need.
سؤال
True/false evaluation is "natural" from a computer's standpoint because computer circuitry consists of two-state on-off switches,often represented by ____.

A) 1 or -1
B) 1 or 0
C) light or dark
D) plus or minus
سؤال
A(n)____ is a value on either side of an operator.

A) operator
B) indicator
C) compound condition
D) operand
سؤال
Trivial expressions will always evaluate to the same result.
سؤال
The selection structure where the logic can flow only to one of the two alternatives,never to both is called a(n)____ structure.

A) if-then
B) if-then-else
C) loop
D) while
سؤال
When new programmers perform range checks,they are prone to using logic that includes too many decisions,entailing more work than is necessary.
سؤال
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.
سؤال
Comparing two amounts in order to decide if they are not equal to each other is the most confusing of all the comparisons.
سؤال
The ____ operator evaluates as true when the left operand is less than or equivalent to the right operand.

A) >=
B) <=
C) >
D) <
سؤال
There are ____ relational comparison operators supported by all modern programming languages.

A) three
B) four
C) five
D) six
سؤال
Any decision can be made using combinations of just three types of comparisons: _____.

A) equal,more than,and less than
B) equal to,greater than,and less than
C) equal to,more,and less
D) equal,not equal to,and greater than
سؤال
You use the logical ____ operator to reverse the meaning of a Boolean expression.

A) NOT
B) AND
C) OR
D) XOR
سؤال
In an OR decision,it is more efficient to first ask the question that is more likely to be ____.

A) greater
B) Boolean
C) false
D) true
سؤال
In an AND decision,it is more efficient to first ask the question that is less likely to be ____.

A) larger
B) Boolean
C) false
D) true
سؤال
If X is true,Y is true,and Z is false,which of the following expressions is true?

A) X AND Y AND Z
B) X OR Y AND Z
C) X AND Y OR Z
D) X > Y AND Z
سؤال
A(n)________ or unreachable path is a logical path that can never be traveled.

A) dead-end
B) dead
C) unstable
D) unattainable
سؤال
A ____ of values is every value between low and high limits.

A) list
B) block
C) range
D) group
سؤال
The conditional AND operator in Java,C++,and C# consists of ____.

A) %%
B) &&
C) ||
D) **
سؤال
In C++,Java,and C#,the ____ is the symbol used for the NOT operator.

A) at-symbol
B) exclamation point
C) underscore
D) tilde
سؤال
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.

A) parentheses
B) braces
C) underscores
D) brackets
سؤال
____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.

A) Truth diagrams
B) Truth matrix
C) Truth tables
D) Logic diagrams
سؤال
When several decisions are based on the value of the same variable,many programming languages offer a shortcut called the ____ structure.

A) sequence
B) while
C) loop
D) case
سؤال
C#,C++,C,and Java use the symbol ____ to represent the logical OR.

A) %%
B) &&
C) ||
D) **
سؤال
Which of the following pseudocode selects all people over 21?

A) if age >= 20 then
B) if age > 20 then
C) if age Not < 21 then
D) if age > 21 then
سؤال
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.

A) cut-off
B) once-over
C) first-time
D) short-circuit
سؤال
A series of nested if statements is also called a ____ if statement.

A) connected
B) stacked
C) cascading
D) trailed
سؤال
When you combine AND and OR operators,the AND operators take ____,meaning their Boolean values are evaluated first.

A) preference
B) priority
C) precedence
D) residence
سؤال
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.

A) AND
B) OR
C) NOR
D) NOT
سؤال
Which of the lettered choices is equivalent to the following decision? if a > 10 then
If b > 10 then
Output "OK"
Endif
Endif

A) if a > 10 OR b > 10 then output "OK"
B) if a > 10 AND a > b then output "OK"
C) if a > 10 AND b > 10 then output "OK"
D) if a > b then output "OK"
سؤال
When you use a(n)____ check,you compare a variable to a series of values that mark the limiting ends of ranges.

A) bounds
B) end
C) range
D) truth
سؤال
A ____ is created when you need to ask multiple questions before an outcome is determined.

A) compound condition
B) compound question
C) truth table
D) trivial expression
سؤال
To most efficiently keep track of the sales for each of the three serving sizes,you would use ____.

A) three completely separate unnested if statements
B) nested if statements using AND logic
C) nested if statements using OR logic
D) four completely separate unnested if statements
سؤال
Write structured pseudocode to show the following: if the value in the studentGrade variable is greater than or equal to RANGE1 and less than RANGE2,move "OK" to outMessage.
Significant declarations:
string outMessage
num studentGrade
num RANGE1 = 0
num RANGE2 = 101
سؤال
What techniques can you use to avoid the confusion of mixing AND and OR operators?
سؤال
Write structured pseudocode to fix this statement:
if hourlyWage > 8.50 and < 15.80 then
سؤال
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 ____.

A) $100 dollars of sales
B) four triple scoop sales
C) four double scoop sales
D) four single scoop sales
سؤال
Rewrite this structured pseudocode without a NOT operator but keeping the same logic:
if NOT hourlyWage <= 20.50 then
سؤال
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 ____.

A) single
B) double
C) triple
D) does not mater
سؤال
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?

A) if Sales > 100 OR tripleScoop > 4
B) if Sales > 100 OR tripleScoop >=4
C) if Sales > 100 AND tripleScoop < 4
D) if Sales > 100 AND tripleScoop > 4
سؤال
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)____.

A) OR
B) AND
C) NOT
D) > operand
سؤال
Write structured pseudocode to show the following: if the value in the studentGrade variable is less that RANGE1 or greater than RANGE2,move "Error" to outMessage.
Significant declarations:
string outMessage
num studentGrade
num RANGE1 = 0
num RANGE2 = 100
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: Making Decisions
1
In any Boolean expression,the two values compared can be either variables or ____.

A) numbers
B) nulls
C) constants
D) trivial expressions
C
2
In every programming language,addition has precedence over multiplication in an arithmetic statement.
False
3
When you use the OR operator,both of the listed conditions must be met for the resulting
action to take place.
False
4
A ____ is a displayed statement that advises a user what to do.For example,"Please enter your name."

A) start
B) question
C) prompt
D) query
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Every decision you make in a computer program involves evaluating a Boolean expression.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
String value: "BLACK HORSE" is equal to "Black Horse".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
If X > Y is false,which of the following is always true?

A) X < Y
B) X <= Y
C) X = Y
D) X >= Y
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
A ____ is one that represents only one of two states,true or false.

A) Boolean expression
B) short-circuit evaluation
C) trivial expression
D) truth table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
Boolean (true/false)expressions are named for George Boolean.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
Most programming languages allow you to combine as many AND and OR operators in an expression as you need.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
True/false evaluation is "natural" from a computer's standpoint because computer circuitry consists of two-state on-off switches,often represented by ____.

A) 1 or -1
B) 1 or 0
C) light or dark
D) plus or minus
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
A(n)____ is a value on either side of an operator.

A) operator
B) indicator
C) compound condition
D) operand
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
Trivial expressions will always evaluate to the same result.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The selection structure where the logic can flow only to one of the two alternatives,never to both is called a(n)____ structure.

A) if-then
B) if-then-else
C) loop
D) while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
When new programmers perform range checks,they are prone to using logic that includes too many decisions,entailing more work than is necessary.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
Comparing two amounts in order to decide if they are not equal to each other is the most confusing of all the comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
The ____ operator evaluates as true when the left operand is less than or equivalent to the right operand.

A) >=
B) <=
C) >
D) <
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
There are ____ relational comparison operators supported by all modern programming languages.

A) three
B) four
C) five
D) six
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Any decision can be made using combinations of just three types of comparisons: _____.

A) equal,more than,and less than
B) equal to,greater than,and less than
C) equal to,more,and less
D) equal,not equal to,and greater than
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
You use the logical ____ operator to reverse the meaning of a Boolean expression.

A) NOT
B) AND
C) OR
D) XOR
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
In an OR decision,it is more efficient to first ask the question that is more likely to be ____.

A) greater
B) Boolean
C) false
D) true
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
In an AND decision,it is more efficient to first ask the question that is less likely to be ____.

A) larger
B) Boolean
C) false
D) true
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
If X is true,Y is true,and Z is false,which of the following expressions is true?

A) X AND Y AND Z
B) X OR Y AND Z
C) X AND Y OR Z
D) X > Y AND Z
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
A(n)________ or unreachable path is a logical path that can never be traveled.

A) dead-end
B) dead
C) unstable
D) unattainable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
A ____ of values is every value between low and high limits.

A) list
B) block
C) range
D) group
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
The conditional AND operator in Java,C++,and C# consists of ____.

A) %%
B) &&
C) ||
D) **
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
In C++,Java,and C#,the ____ is the symbol used for the NOT operator.

A) at-symbol
B) exclamation point
C) underscore
D) tilde
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
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.

A) parentheses
B) braces
C) underscores
D) brackets
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.

A) Truth diagrams
B) Truth matrix
C) Truth tables
D) Logic diagrams
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
When several decisions are based on the value of the same variable,many programming languages offer a shortcut called the ____ structure.

A) sequence
B) while
C) loop
D) case
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
C#,C++,C,and Java use the symbol ____ to represent the logical OR.

A) %%
B) &&
C) ||
D) **
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following pseudocode selects all people over 21?

A) if age >= 20 then
B) if age > 20 then
C) if age Not < 21 then
D) if age > 21 then
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
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.

A) cut-off
B) once-over
C) first-time
D) short-circuit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
A series of nested if statements is also called a ____ if statement.

A) connected
B) stacked
C) cascading
D) trailed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
When you combine AND and OR operators,the AND operators take ____,meaning their Boolean values are evaluated first.

A) preference
B) priority
C) precedence
D) residence
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
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.

A) AND
B) OR
C) NOR
D) NOT
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
Which of the lettered choices is equivalent to the following decision? if a > 10 then
If b > 10 then
Output "OK"
Endif
Endif

A) if a > 10 OR b > 10 then output "OK"
B) if a > 10 AND a > b then output "OK"
C) if a > 10 AND b > 10 then output "OK"
D) if a > b then output "OK"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
When you use a(n)____ check,you compare a variable to a series of values that mark the limiting ends of ranges.

A) bounds
B) end
C) range
D) truth
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
A ____ is created when you need to ask multiple questions before an outcome is determined.

A) compound condition
B) compound question
C) truth table
D) trivial expression
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
To most efficiently keep track of the sales for each of the three serving sizes,you would use ____.

A) three completely separate unnested if statements
B) nested if statements using AND logic
C) nested if statements using OR logic
D) four completely separate unnested if statements
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
Write structured pseudocode to show the following: if the value in the studentGrade variable is greater than or equal to RANGE1 and less than RANGE2,move "OK" to outMessage.
Significant declarations:
string outMessage
num studentGrade
num RANGE1 = 0
num RANGE2 = 101
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
What techniques can you use to avoid the confusion of mixing AND and OR operators?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Write structured pseudocode to fix this statement:
if hourlyWage > 8.50 and < 15.80 then
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
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 ____.

A) $100 dollars of sales
B) four triple scoop sales
C) four double scoop sales
D) four single scoop sales
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Rewrite this structured pseudocode without a NOT operator but keeping the same logic:
if NOT hourlyWage <= 20.50 then
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
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 ____.

A) single
B) double
C) triple
D) does not mater
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
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?

A) if Sales > 100 OR tripleScoop > 4
B) if Sales > 100 OR tripleScoop >=4
C) if Sales > 100 AND tripleScoop < 4
D) if Sales > 100 AND tripleScoop > 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
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)____.

A) OR
B) AND
C) NOT
D) > operand
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Write structured pseudocode to show the following: if the value in the studentGrade variable is less that RANGE1 or greater than RANGE2,move "Error" to outMessage.
Significant declarations:
string outMessage
num studentGrade
num RANGE1 = 0
num RANGE2 = 100
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.