Deck 4: Making Decisions

ملء الشاشة (f)
exit full mode
سؤال
The operator takes an operand and reverses its truth or falsehood.

A)&&
B)!
C)relational
D)!=
E)||
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A flag is a variable, usually of data type , that signals whether or not some condition exists.

A)logical
B)string
C)char
D)bool
E)int
سؤال
Two different variables in the same program may have the same name

A)if they always hold different values.
B)if the second one is never declared.
C)if they have different scope.
D)if the second one is initialized with a different value than the first one.
E)never. A program cannot have two variables with the same name.
سؤال
Relational operators allow you to numbers.

A)average
B)verify
C)add
D)compare
E)multiply
سؤال
The statement executes one statement, or block of statements, if a condition is true and skips it, doing nothing, if the condition is false.

A)if
B)switch
C)if/else
D)if/endif
E)if/else if
سؤال
When an if statement is placed within the conditionally- executed code of another if statement, this is known as a(n)

A)overloaded if
B)conditional if
C)complex if
D)double if
E)nested if
سؤال
The expression x < y is called a(n)expression.

A)logical
B)relational
C)binary
D)arithmetic
E)comparison
سؤال
A(n)is a variable, usually a bool, that signals when a condition exists.

A)identifier
B)named constant
C)condition variable
D)logical variable
E)flag
سؤال
In C++ when a relational expression is false, it has the value
A)"0".

A)1.
B)0.
D)- 1.
E)of any negative number.
سؤال
The statement acts like a chain of if statements. Each performs its test, one after the other, until one of them is found to be true.

A)if/then
B)if/endif
C)if/else if
D)if/not if
E)if/else
سؤال
If s1 and s2 are string objects, s1 == s2 is true when

A)s1 = "cat" and s2 = "cat ".
B)s1 = "lion" and s2 = "lioness".
C)s1 = "dog" and s2 = "DOG".
D)None of these because in each case one or more characters in the strings have different ASCII codes.
E)None of these because string objects cannot be compared with relational operators.
سؤال
If a switch statement has no statements, the program "falls through" all of the statements below the one with the matching case expression.

A)relational
B)break
C)default
D)exit
E)case
سؤال
The statement executes one block of statements if a test condition is true, and another block if the condition is false.

A)if/else if
B)trailing else
C)if/else
D)switch
E)if
سؤال
What will the following expression evaluate to? <strong>What will the following expression evaluate to?  </strong> A)0 B)6 C)-1 D)true E)false <div style=padding-top: 35px>

A)0
B)6
C)-1
D)true
E)false
سؤال
What will the following statement do if x equals 17 and answer = 20? answer = x > 100 ? 0 : 1;

A)Assign 0 to x.
B)Assign 17 to answer.
C)Assign 1 to answer.
D)Assign 0 to answer.
E)Assign 1 to x.
سؤال
The statement causes other program statements to execute only under certain conditions.

A)logical
B)cout
C)cin
D)if
E)relational
سؤال
A trailing else placed at the end of an if/else if statement provides a default action when of the if conditions is/are true.

A)none
B)all
C)any one
D)only the last one
E)at least two
سؤال
The default section of a switch statement performs a similar task as the portion of an if/else if statement.

A)conditional test
B)trailing else
C)else if
D)break
E)body
سؤال
Which of the following correctly declares an enumerated data type named student?

A)enum student { "Bill", "Tom", "Mary" };
B)int Bill = 1, Tom = 2, Mary = 3; enum student { 1, 2, 3 };
C)enum student { Bill, Tom, Mary };
D)Any of the above 3 methods will work.
E)None of the above 3 methods will work.
سؤال
When a program lets the user know that an invalid menu choice has been made, this is an example of

A)being user unfriendly.
B)input validation.
C)invalidation.
D)output validation.
E)menu reselection.
سؤال
If the sub- expression on the left side of an || operator is true, the expression on the right side will not be checked.
سؤال
A switch statement branches to a particular block of code depending on the value of a numeric (i.e. integer or floating- point)variable or constant.
سؤال
All of the relational operators are binary.
سؤال
A pair of characters or a pair of string objects can be compared with any of the relational operators.
سؤال
The following C++ test checks if the variable child is in the range 3- 12.
The following C++ test checks if the variable child is in the range 3- 12.  <div style=padding-top: 35px>
سؤال
The three logical operators, AND, OR, and NOT, all have the same precedence.
سؤال
The statement
The statement  <div style=padding-top: 35px>
سؤال
The rule for matching an else with an if is that an else goes with the last if
statement before it that doesn't have its own else.
سؤال
To check if a variable has a particular value, use the = relational operator, as in the statement
To check if a variable has a particular value, use the = relational operator, as in the statement  <div style=padding-top: 35px>
سؤال
Relational expressions and logical expressions are both Boolean, which means they evaluate to true or false.
سؤال
The following C++ test checks if the variable child is in the range 3-12.
The following C++ test checks if the variable child is in the range 3-12.  <div style=padding-top: 35px>
سؤال
The following statement s will not print anything.
The following statement s will not print anything.  <div style=padding-top: 35px>
سؤال
If the sub- expression on the left side of an && operator is true, the expression on the right side will not be checked.
سؤال
Assuming moreData is a Boolean variable, the following two tests are logically equivalent.
Assuming moreData is a Boolean variable, the following two tests are logically equivalent.  <div style=padding-top: 35px>
سؤال
In C++ an expression that evaluates to 5, - 5, or for that matter anything other than 0, is considered true by an if statement.
سؤال
Relational operators connect two or more relational expressions into one, or reverse the logic of an expression.
سؤال
Assuming goodData is a Boolean variable, the following two tests are logically equivalent.
Assuming goodData is a Boolean variable, the following two tests are logically equivalent.  <div style=padding-top: 35px>
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/37
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 4: Making Decisions
1
The operator takes an operand and reverses its truth or falsehood.

A)&&
B)!
C)relational
D)!=
E)||
B
2
A flag is a variable, usually of data type , that signals whether or not some condition exists.

A)logical
B)string
C)char
D)bool
E)int
D
3
Two different variables in the same program may have the same name

A)if they always hold different values.
B)if the second one is never declared.
C)if they have different scope.
D)if the second one is initialized with a different value than the first one.
E)never. A program cannot have two variables with the same name.
C
4
Relational operators allow you to numbers.

A)average
B)verify
C)add
D)compare
E)multiply
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
5
The statement executes one statement, or block of statements, if a condition is true and skips it, doing nothing, if the condition is false.

A)if
B)switch
C)if/else
D)if/endif
E)if/else if
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
6
When an if statement is placed within the conditionally- executed code of another if statement, this is known as a(n)

A)overloaded if
B)conditional if
C)complex if
D)double if
E)nested if
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
7
The expression x < y is called a(n)expression.

A)logical
B)relational
C)binary
D)arithmetic
E)comparison
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
8
A(n)is a variable, usually a bool, that signals when a condition exists.

A)identifier
B)named constant
C)condition variable
D)logical variable
E)flag
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
9
In C++ when a relational expression is false, it has the value
A)"0".

A)1.
B)0.
D)- 1.
E)of any negative number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
10
The statement acts like a chain of if statements. Each performs its test, one after the other, until one of them is found to be true.

A)if/then
B)if/endif
C)if/else if
D)if/not if
E)if/else
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
11
If s1 and s2 are string objects, s1 == s2 is true when

A)s1 = "cat" and s2 = "cat ".
B)s1 = "lion" and s2 = "lioness".
C)s1 = "dog" and s2 = "DOG".
D)None of these because in each case one or more characters in the strings have different ASCII codes.
E)None of these because string objects cannot be compared with relational operators.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
12
If a switch statement has no statements, the program "falls through" all of the statements below the one with the matching case expression.

A)relational
B)break
C)default
D)exit
E)case
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
13
The statement executes one block of statements if a test condition is true, and another block if the condition is false.

A)if/else if
B)trailing else
C)if/else
D)switch
E)if
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
14
What will the following expression evaluate to? <strong>What will the following expression evaluate to?  </strong> A)0 B)6 C)-1 D)true E)false

A)0
B)6
C)-1
D)true
E)false
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
15
What will the following statement do if x equals 17 and answer = 20? answer = x > 100 ? 0 : 1;

A)Assign 0 to x.
B)Assign 17 to answer.
C)Assign 1 to answer.
D)Assign 0 to answer.
E)Assign 1 to x.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
16
The statement causes other program statements to execute only under certain conditions.

A)logical
B)cout
C)cin
D)if
E)relational
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
17
A trailing else placed at the end of an if/else if statement provides a default action when of the if conditions is/are true.

A)none
B)all
C)any one
D)only the last one
E)at least two
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
18
The default section of a switch statement performs a similar task as the portion of an if/else if statement.

A)conditional test
B)trailing else
C)else if
D)break
E)body
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following correctly declares an enumerated data type named student?

A)enum student { "Bill", "Tom", "Mary" };
B)int Bill = 1, Tom = 2, Mary = 3; enum student { 1, 2, 3 };
C)enum student { Bill, Tom, Mary };
D)Any of the above 3 methods will work.
E)None of the above 3 methods will work.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
20
When a program lets the user know that an invalid menu choice has been made, this is an example of

A)being user unfriendly.
B)input validation.
C)invalidation.
D)output validation.
E)menu reselection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
21
If the sub- expression on the left side of an || operator is true, the expression on the right side will not be checked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
22
A switch statement branches to a particular block of code depending on the value of a numeric (i.e. integer or floating- point)variable or constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
23
All of the relational operators are binary.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
24
A pair of characters or a pair of string objects can be compared with any of the relational operators.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
25
The following C++ test checks if the variable child is in the range 3- 12.
The following C++ test checks if the variable child is in the range 3- 12.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
26
The three logical operators, AND, OR, and NOT, all have the same precedence.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
27
The statement
The statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
28
The rule for matching an else with an if is that an else goes with the last if
statement before it that doesn't have its own else.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
29
To check if a variable has a particular value, use the = relational operator, as in the statement
To check if a variable has a particular value, use the = relational operator, as in the statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
30
Relational expressions and logical expressions are both Boolean, which means they evaluate to true or false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
31
The following C++ test checks if the variable child is in the range 3-12.
The following C++ test checks if the variable child is in the range 3-12.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
32
The following statement s will not print anything.
The following statement s will not print anything.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
33
If the sub- expression on the left side of an && operator is true, the expression on the right side will not be checked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
34
Assuming moreData is a Boolean variable, the following two tests are logically equivalent.
Assuming moreData is a Boolean variable, the following two tests are logically equivalent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
35
In C++ an expression that evaluates to 5, - 5, or for that matter anything other than 0, is considered true by an if statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
36
Relational operators connect two or more relational expressions into one, or reverse the logic of an expression.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
37
Assuming goodData is a Boolean variable, the following two tests are logically equivalent.
Assuming goodData is a Boolean variable, the following two tests are logically equivalent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.