Deck 4: Making Decisions
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/37
العب
ملء الشاشة (f)
Deck 4: Making Decisions
1
The operator takes an operand and reverses its truth or falsehood.
A)&&
B)!
C)relational
D)!=
E)||
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
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.
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
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
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
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
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
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.
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
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.
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
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
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? 
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.
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
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
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
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.
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.
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.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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.
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


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
32
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.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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.


فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck

