Deck 7: Complex Conditions

ملء الشاشة (f)
exit full mode
سؤال
Numeric variables can be used to hold values such as "true" and "false" or "yes" and "no."
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The Boolean variable was developed by Tim Berners-Lee, who also developed logical concepts.
سؤال
An advantage of the Boolean data type is that when testing a variable's value, a true value is assumed without having to state it.
سؤال
When testing to see whether a Boolean variable's value is false, you must include the == True or use the keyword Not in front of the variable.
سؤال
When testing whether the value of a Boolean variable is true, you do not need to include the relational operator and the value (as in == True) in the condition.
سؤال
If you are assigning a value to a Boolean variable, you need to include the assignment operator and the value = True or = False.
سؤال
Conditions are joined with the keyword And or Or.
سؤال
In JavaScript, a single condition can be negated with the keyword Nor.
سؤال
In a decision table, you put a dash in cells containing irrelevant conditions and then merge the columns.
سؤال
Each path on a binary tree leads to another condition that also splits into two paths.
سؤال
If a condition is irrelevant at some point on a binary tree, it does not need to be split into true and false paths.
سؤال
A decision table is usually converted into a binary tree.
سؤال
In JavaScript, the And operator is &.
سؤال
In JavaScript, the Or operator is //.
سؤال
In JavaScript, the Not operator is ||.
سؤال
Conditions in JavaScript are enclosed in parentheses.
سؤال
The following JavaScript code is a repetition statement.
if (age >= 18 && age <= 65) {
document.write("The age is between 18 and 65." + BR);
}
سؤال
When two conditions joined by the logical And operator are evaluated, if the first one is false, there is no need for the computer to evaluate the second one.
سؤال
If you have statistics on the expected frequency of condition evaluations, you should use them to make your program faster and more efficient.
سؤال
In the following pseudocode, if any of three conditions evaluates as true, the combined condition is also true.
If code == "SF" Or code == "SP" Or code == "SB" Then
Display "Your order has been shipped."
End If
سؤال
Logical operations have a specified order of precedence, just as arithmetic operations do.
سؤال
In JavaScript, the Or operator takes precedence over And.
سؤال
In JavaScript, you should use parentheses to make your intentions clear to both the computer and the reader.
سؤال
When one of the conditions in a complex condition is treated differently than the combined condition, nested conditions result in the clearest logic and the fewest comparisons.
سؤال
The Math class in JavaScript has the random() method.
سؤال
A ____ occurs when two or more conditions have to be evaluated for an action to take place.

A) validation loop
B) complex condition
C) short-circuit evaluation
D) dual-outcome selection
سؤال
Which of the following sets of conditions is equivalent?

A) paymentIsOverdue = True
SeniorCitizen = False

B) Declare Boolean paymentIsOverdue Declare Boolean seniorCitizen

C) If paymentIsOverdue
If paymentIsOverdue == True

D) Declare Boolean personHasMoney
Declare Boolean showedID
سؤال
The keywords And, Or, and Not, are known as ____.

A) decision tables
B) relational operators
C) logical operators
D) static variables
سؤال
Which of the following is considered a dual-outcome selection?

A) If Not balance < 200 Then
Display "Your account will continue to earn interest."
End If

B) If personHasMoney And showedID Then
TicketPrice = discountPrice
Else
TicketPrice = regularPrice
End If

C) If personHasMoney And showedID Then
TicketPrice = discountPrice
End If

D) If password != "sugarBear" Then
Display "Sorry, incorrect password."
End If
سؤال
Which of the following pseudocode statements express the condition below?
A movie theater admits a customer free if he or she is under 2 years old or if he or she is 65 or older.

A) If age < 65 Or age >=2 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

B) If age < 2 Or age <= 65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

C) If age > 2 Or age < 65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

D) If age < 2 Or age >=65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice
سؤال
Which of the following pseudocode statements expresses the condition below?
A hotel customer gets a 10% discount for showing a hotel club card or a travel club card.

A) If showsHotelClubCard And showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

B) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.00
Else
Discount = 0.10
End If

C) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

D) If showsHotelClubCard And showsTravelClubCard Then
Discount = 0.00
Else
Discount = 0.10
End If
سؤال
Which of the following uses the unary logical operator?

A) If password != "sugarBear" Then
Display "Sorry, incorrect password."
End If

B) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

C) If personHasMoney And showedID Then
TicketPrice = discountPrice
End If

D) If balance >= 200 Then
Display "Your account will continue to earn interest."
End If
سؤال
And and Or are called ____ because they operate on two conditions, joining them into a combined condition.

A) unary logical operators
B) relational operators
C) static operators
D) binary logical operators
سؤال
The Not operator, which is placed before a condition to negate it, is a(n) ____ because it operates on a single condition or a single combined condition.

A) unary logical operator
B) relational operator
C) binary logical operator
D) static operator
سؤال
A(n) ____ is a tool for expressing the results of combinations of conditions.

A) flowchart
B) UML diagram
C) truth table
D) logical operator
سؤال
When two conditions are joined by the logical ____ operator, both must be true for the combined condition to be true.

A) Or
B) And
C) Not
D) Equal
سؤال
A ____ enables you to state all conditions relevant to a decision, the true and false combinations of these conditions, and the outcomes associated with each combination.

A) decision table
B) selection structure
C) repetition structure
D) sequence structure
سؤال
With a ____, each condition must be stated as a Boolean condition, with only true and false possibilities as answers.

A) UML diagram
B) flowchart
C) selection structure
D) decision table
سؤال
A ____ traces all combinations by starting with one condition and splitting into true and false paths.

A) binary tree
B) relational operator
C) logical operator
D) truth table
سؤال
A method for indicating the outcome of combining conditions that appeals to right-brained people is a ____.

A) binary tree
B) selection structure
C) sequence structure
D) repetition structure
سؤال
On a binary tree, ____ are used to represent conditions.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
سؤال
On a binary tree, ____ are used to represent branches.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
سؤال
On a binary tree, ____ are used to represent outcomes.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
سؤال
Which of the following represents a negated condition?

A) if (daysOverdue > 10 || fineOwed > 0.00) {
Document.write("Please call the library immediately!"
+ BR);
}

B) if (!(daysOverdue > 10 || fineOwed > 0.00)) {
Document.write("Your account is in good standing." + BR);
}

C) if (age >= 18 && age <= 65) {
Document.write("The age is between 18 and 65." + BR);
}

D) function inquiry(balance) {
Document.write("Your current balance is: $" +
Balance.toFixed(2) + BR);
}
سؤال
Which of the following represents an example of data validation?

A) if (daysOverdue > 10 || fineOwed > 0.00) {
Document.write("Please call the library immediately!"
+ BR);
}

B) if (!(daysOverdue > 10 || fineOwed > 0.00)) {
Document.write("Your account is in good standing." + BR);
}

C) if (age >= 18 && age <= 65) {
Document.write("The age is between 18 and 65." + BR);
}

D) while (!(month >= 1 && month <= 12)) {
Month = prompt
("ERROR...Enter a number between 1 and 12",ES);
}
سؤال
A(n) ____ is a process that does not evaluate the second condition of a combined condition if evaluation of the first condition determines the outcome.

A) logical evaluation
B) unary evaluation
C) short-circuit evaluation
D) binary evaluation
سؤال
A(n) ____ is used when you need one action performed when the combined condition is true and another action performed when the combined condition is false.

A) truth table
B) complex condition
C) nested condition
D) short-circuit evaluation
سؤال
Which of the following generates a random number between 0 and 1?

A) var randomNum = Math.random();
Document.write(randomNum);

B) var randomNum = Calculate.random();
Document.write(randomNum);

C) var randomNum = Number.random();
Document.write(randomNum);

D) var randomNum = Math.randomNumber();
Document.write(randomNum);
سؤال
Which of the following generates a random number between 0 and 10?

A) var randomNum = Math.random() * 10;
RandomNum = Math.floor(randomNum)+ 1;
Document.write(randomNum);

B) var randomNum = Calculate.random() * 10;
Document.write(randomNum);

C) var randomNum = Number.random() * 10;
Document.write(randomNum);

D) var randomNum = Math.randomNumber() * 10;
Document.write(randomNum);
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/49
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Complex Conditions
1
Numeric variables can be used to hold values such as "true" and "false" or "yes" and "no."
False
2
The Boolean variable was developed by Tim Berners-Lee, who also developed logical concepts.
False
3
An advantage of the Boolean data type is that when testing a variable's value, a true value is assumed without having to state it.
True
4
When testing to see whether a Boolean variable's value is false, you must include the == True or use the keyword Not in front of the variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
5
When testing whether the value of a Boolean variable is true, you do not need to include the relational operator and the value (as in == True) in the condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
6
If you are assigning a value to a Boolean variable, you need to include the assignment operator and the value = True or = False.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
7
Conditions are joined with the keyword And or Or.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
8
In JavaScript, a single condition can be negated with the keyword Nor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
9
In a decision table, you put a dash in cells containing irrelevant conditions and then merge the columns.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
10
Each path on a binary tree leads to another condition that also splits into two paths.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
11
If a condition is irrelevant at some point on a binary tree, it does not need to be split into true and false paths.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
12
A decision table is usually converted into a binary tree.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
13
In JavaScript, the And operator is &.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
14
In JavaScript, the Or operator is //.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
15
In JavaScript, the Not operator is ||.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
16
Conditions in JavaScript are enclosed in parentheses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
17
The following JavaScript code is a repetition statement.
if (age >= 18 && age <= 65) {
document.write("The age is between 18 and 65." + BR);
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
18
When two conditions joined by the logical And operator are evaluated, if the first one is false, there is no need for the computer to evaluate the second one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
19
If you have statistics on the expected frequency of condition evaluations, you should use them to make your program faster and more efficient.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
20
In the following pseudocode, if any of three conditions evaluates as true, the combined condition is also true.
If code == "SF" Or code == "SP" Or code == "SB" Then
Display "Your order has been shipped."
End If
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
21
Logical operations have a specified order of precedence, just as arithmetic operations do.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
22
In JavaScript, the Or operator takes precedence over And.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
23
In JavaScript, you should use parentheses to make your intentions clear to both the computer and the reader.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
24
When one of the conditions in a complex condition is treated differently than the combined condition, nested conditions result in the clearest logic and the fewest comparisons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
25
The Math class in JavaScript has the random() method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
26
A ____ occurs when two or more conditions have to be evaluated for an action to take place.

A) validation loop
B) complex condition
C) short-circuit evaluation
D) dual-outcome selection
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following sets of conditions is equivalent?

A) paymentIsOverdue = True
SeniorCitizen = False

B) Declare Boolean paymentIsOverdue Declare Boolean seniorCitizen

C) If paymentIsOverdue
If paymentIsOverdue == True

D) Declare Boolean personHasMoney
Declare Boolean showedID
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
28
The keywords And, Or, and Not, are known as ____.

A) decision tables
B) relational operators
C) logical operators
D) static variables
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following is considered a dual-outcome selection?

A) If Not balance < 200 Then
Display "Your account will continue to earn interest."
End If

B) If personHasMoney And showedID Then
TicketPrice = discountPrice
Else
TicketPrice = regularPrice
End If

C) If personHasMoney And showedID Then
TicketPrice = discountPrice
End If

D) If password != "sugarBear" Then
Display "Sorry, incorrect password."
End If
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
30
Which of the following pseudocode statements express the condition below?
A movie theater admits a customer free if he or she is under 2 years old or if he or she is 65 or older.

A) If age < 65 Or age >=2 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

B) If age < 2 Or age <= 65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

C) If age > 2 Or age < 65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice

D) If age < 2 Or age >=65 Then
AdmissionPrice = 0
Else
AdmissionPrice = regularPrice
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following pseudocode statements expresses the condition below?
A hotel customer gets a 10% discount for showing a hotel club card or a travel club card.

A) If showsHotelClubCard And showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

B) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.00
Else
Discount = 0.10
End If

C) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

D) If showsHotelClubCard And showsTravelClubCard Then
Discount = 0.00
Else
Discount = 0.10
End If
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following uses the unary logical operator?

A) If password != "sugarBear" Then
Display "Sorry, incorrect password."
End If

B) If showsHotelClubCard Or showsTravelClubCard Then
Discount = 0.10
Else
Discount = 0.00
End If

C) If personHasMoney And showedID Then
TicketPrice = discountPrice
End If

D) If balance >= 200 Then
Display "Your account will continue to earn interest."
End If
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
33
And and Or are called ____ because they operate on two conditions, joining them into a combined condition.

A) unary logical operators
B) relational operators
C) static operators
D) binary logical operators
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
34
The Not operator, which is placed before a condition to negate it, is a(n) ____ because it operates on a single condition or a single combined condition.

A) unary logical operator
B) relational operator
C) binary logical operator
D) static operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
35
A(n) ____ is a tool for expressing the results of combinations of conditions.

A) flowchart
B) UML diagram
C) truth table
D) logical operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
36
When two conditions are joined by the logical ____ operator, both must be true for the combined condition to be true.

A) Or
B) And
C) Not
D) Equal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
37
A ____ enables you to state all conditions relevant to a decision, the true and false combinations of these conditions, and the outcomes associated with each combination.

A) decision table
B) selection structure
C) repetition structure
D) sequence structure
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
38
With a ____, each condition must be stated as a Boolean condition, with only true and false possibilities as answers.

A) UML diagram
B) flowchart
C) selection structure
D) decision table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
39
A ____ traces all combinations by starting with one condition and splitting into true and false paths.

A) binary tree
B) relational operator
C) logical operator
D) truth table
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
40
A method for indicating the outcome of combining conditions that appeals to right-brained people is a ____.

A) binary tree
B) selection structure
C) sequence structure
D) repetition structure
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
41
On a binary tree, ____ are used to represent conditions.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
42
On a binary tree, ____ are used to represent branches.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
43
On a binary tree, ____ are used to represent outcomes.

A) flowlines
B) ovals
C) diamond boxes
D) process rectangles
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following represents a negated condition?

A) if (daysOverdue > 10 || fineOwed > 0.00) {
Document.write("Please call the library immediately!"
+ BR);
}

B) if (!(daysOverdue > 10 || fineOwed > 0.00)) {
Document.write("Your account is in good standing." + BR);
}

C) if (age >= 18 && age <= 65) {
Document.write("The age is between 18 and 65." + BR);
}

D) function inquiry(balance) {
Document.write("Your current balance is: $" +
Balance.toFixed(2) + BR);
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following represents an example of data validation?

A) if (daysOverdue > 10 || fineOwed > 0.00) {
Document.write("Please call the library immediately!"
+ BR);
}

B) if (!(daysOverdue > 10 || fineOwed > 0.00)) {
Document.write("Your account is in good standing." + BR);
}

C) if (age >= 18 && age <= 65) {
Document.write("The age is between 18 and 65." + BR);
}

D) while (!(month >= 1 && month <= 12)) {
Month = prompt
("ERROR...Enter a number between 1 and 12",ES);
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
46
A(n) ____ is a process that does not evaluate the second condition of a combined condition if evaluation of the first condition determines the outcome.

A) logical evaluation
B) unary evaluation
C) short-circuit evaluation
D) binary evaluation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
47
A(n) ____ is used when you need one action performed when the combined condition is true and another action performed when the combined condition is false.

A) truth table
B) complex condition
C) nested condition
D) short-circuit evaluation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which of the following generates a random number between 0 and 1?

A) var randomNum = Math.random();
Document.write(randomNum);

B) var randomNum = Calculate.random();
Document.write(randomNum);

C) var randomNum = Number.random();
Document.write(randomNum);

D) var randomNum = Math.randomNumber();
Document.write(randomNum);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
49
Which of the following generates a random number between 0 and 10?

A) var randomNum = Math.random() * 10;
RandomNum = Math.floor(randomNum)+ 1;
Document.write(randomNum);

B) var randomNum = Calculate.random() * 10;
Document.write(randomNum);

C) var randomNum = Number.random() * 10;
Document.write(randomNum);

D) var randomNum = Math.randomNumber() * 10;
Document.write(randomNum);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 49 في هذه المجموعة.