Deck 4: Making Decisions

ملء الشاشة (f)
exit full mode
سؤال
What will the following segment of code output? You can assume the user enters a grade of 90 from the keyboard. cout << "Enter a test score: ";
Cin >> test_score;
If (test_score < 60);
Cout << "You failed the test!" << endl;
If (test_score > 60)
Cout << "You passed the test!" << endl;
Else
Cout << "You need to study for the next test!";

A) You failed the test!
B) You passed the test!
C) You failed the test!
You passed the test!
D) You failed the test!
You did poorly on the test!
E) None of the above
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
This operator represents the logical AND.

A) ++
B) ||
C) &&
D) @
E) None of these
سؤال
Relational operators allow you to ____________ numbers.

A) add
B) multiply
C) compare
D) average
E) None of these
سؤال
After execution of the following code, what will be the value of input_value if the value 0 is entered at the keyboard at run time? cin >> input_value;
If (input_value > 5)
Input_value = input_value + 5;
Else if (input_value > 2)
Input_value = input_value + 10;
Else
Input_value = input_value + 15;

A) 15
B) 10
C) 25
D) 0
E) 5
سؤال
What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables. a = x >= y;

A) 10
B) 7
C) The string "x >= y"
D) 1
E) 0
سؤال
What is the output of the following segment of code if 4 is input by the user when asked to enter a number? int num;
Int total = 0;
Cout << "Enter a number from 1 to 10: ";
Cin >> num;
Switch (num)
{
Case 1:
Case 2: total = 5;
Case 3: total = 10;
Case 4: total = total + 3;
Case 8: total = total + 6;
Default: total = total + 4;
}
Cout << total << endl;

A) 0
B) 3
C) 13
D) 28
E) None of these
سؤال
What will be the output of the following code segment after the user enters 0 at the keyboard? int x = -1;
Cout << "Enter a 0 or a 1 from the keyboard: ";
Cin >> x;
If (x)
Cout << "true" << endl;
Else
Cout << "false" << endl;

A) Nothing will be displayed
B) false
C) x
D) true
سؤال
When a relational expression is false, it has the value _____.

A) one
B) zero
C) zero, one, or minus one
D) less than zero
E) None of these
سؤال
What will following segment of code output? int x = 5;
If (x = 2)
Cout << "This is true!" << endl;
Else
Cout << "This is false!" << endl;
Cout << "This is all folks!" << endl;

A) This is true!
B) This is false!
C) This is true!
This is false!
D) This is true!
This is all folks!
E) None of these
سؤال
This statement lets the value of a variable or expression determine where the program will branch to.

A) switch
B) select
C) associative
D) scope
E) None of these
سؤال
Whereas < is called a relational operator, x < y is called a(n)________________

A) Arithmetic operator
B) Relative operator
C) Relational expression
D) Largeness test
E) None of these
سؤال
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

A) break
B) exit
C) switch
D) scope
E) None of these
سؤال
This is a variable, usually a boolean or an integer, that signals when a condition exists.

A) relational operator
B) arithmetic operator
C) flag
D) float
E) None of these
سؤال
Input values should always be checked for

A) Appropriate range
B) Reasonableness
C) Division by zero, if division is taking place
D) All of these
E) None of these
سؤال
x <= (y * 2)

A) 3, 4, 6, 7 are False
B) Only 5 is False
C) 3 and 4 are False
D) All are False
E) None of these
سؤال
This operator is used in C++ to represent equality.

A) =
B) ><
C) !!
D) ==
E) None of these
سؤال
What will the following segment of code output? score = 40;
If (score > 95)
Cout << "Congratulations!\n";
Cout << "That's a high score!\n";
Cout << "This is a test question!" << endl;

A) This is a test question!
B) Congratulations!
That's a high score!
This is a test question!
C) That's a high score!
This is a test question!
D) Congratulations!
That's a high score!
E) None of these
سؤال
When an if statement is placed within the conditionally-executed code of another if statement, this is known as:

A) complexity
B) overloading
C) nesting
D) validation
E) None of these
سؤال
If you place a semicolon after the statement if (x < y)

A) The code will not compile.
B) The compiler will interpret the semicolon as a null statement.
C) The if statement will always evaluate to false.
D) All of the above.
E) None of these.
سؤال
This operator takes an operand and reverses its truth or falsehood.

A) ||
B) relational
C) arithmetic
D) !
E) None of these
سؤال
This operator performs a logical NOT operation.

A) --
B) !
C) <>
D) ><
E) None of these
سؤال
The default section of a switch statement performs a similar task as the _______ portion of an if/else if statement.

A) conditional
B) break
C) trailing else
D) All of these
E) None of these
سؤال
What is the value of the following expression? true && false

A) true
B) false
C) -1
D) +1
سؤال
Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1;
Y = y + z;
X = x + y;
Cout << "result = "
<< (x < y ? y : x)
<< endl;

A) 0
B) 1
C) 2
D) 3
E) None of these
سؤال
Which statement allows you to properly check the char variable code to determine whether it is equal to a "C" and then output "This is a check" and then advance to a new line?

A) if code is equal to C
Cout << "This is a check\n";
B) if (code = "C")
Cout << "This is a check" << endl;
)
C) if (code == 'C')
Cout << "This is a check\n";
D) if (code == C)
Cout << "This is a check" << endl;
سؤال
What will the following program display? #include
Using namespace std;
Int main()
{
Int a = 0, b = 2, x = 4, y = 0;
Cout << (a == b) << " ";
Cout << (a != b) << " ";
Cout << (b <=x) << " ";
Cout << (y > a) << endl;
Return 0;
}

A) 0 1 1 0
B) 0 0 1 0
C) 1 1 0 1
D) 1 0 0 1
E) None of these
سؤال
In C++ the = operator indicates

A) equality
B) assignment
C) subtraction
D) negation
E) None of these
سؤال
What is the value of the following expression? true && true

A) true
B) false
C) -1
D) +1
سؤال
The ________ of a variable is limited to the block in which it is declared.

A) precedence
B) associativity
C) scope
D) branching ability
E) None of these
سؤال
What will the following segment of code output if 11 is entered at the keyboard? int number;
Cin >> number;
If (number > 0)
Cout << "C++";
Else
Cout << "Soccer";
Cout << " is ";
Cout << "fun" << endl;

A) C++ is fun
B) Soccer is fun
C) C++
D) C++fun
E) Soccerfun
سؤال
What is the value of the following expression? false || true

A) true
B) false
C) -1
D) +1
سؤال
What is the value of donuts after the following code executes? int donuts = 10;
If (donuts = 1)
Donuts = 0;
Else
Donuts += 2;

A) 12
B) 10
C) 0
D) 1
سؤال
When a program lets the user know that an invalid choice has been made, this is known as:

A) input validation
B) output correction
C) compiler criticism
D) output validation
E) None of these
سؤال
What is the value of the following expression? true || true

A) true
B) false
C) -1
D) +1
سؤال
Given that x = 2, y = 1, and z = 0, what will the following cout statement display? cout << "answer = " << (x || !y && z) << endl;

A) answer = 0
B) answer = 1
C) answer = 2
D) None of these
سؤال
These operators connect two or more relational expressions into one, or reverse the logic of an expression.

A) relational
B) logical
C) irrational
D) negation
E) None of these
سؤال
This operator is known as the logical OR operator.

A) --
B) //
C) #
D) ||
E) None of these
سؤال
What will the following program segment display? int funny = 7, serious = 15;
Funny = serious % 2;
If (funny != 1)
{
Funny = 0;
Serious = 0;
}
Else if (funny == 2)
{
Funny = 10;
Serious = 10;
}
Else
{
Funny = 1;
Serious = 1;
}
Cout << funny << " " << serious << endl;

A) 7 15
B) 0 0
C) 10 10
D) 1 1
E) None of these
سؤال
If you intend to place a block of statements within an if statement, you must place these around the block.

A) parentheses ( )
B) square brackets [ ]
C) quotation marks ? ?
D) curly braces { }
E) None of these
سؤال
What is the value of donuts after the following code executes? int donuts = 10;
If (donuts != 10)
Donuts = 0;
Else
Donuts += 2;

A) 12
B) 10
C) 0
D) 2
سؤال
Which value can be entered to cause the following code segment to display the message "That number is acceptable." int number;
Cin >> number;
If (number > 10 && number < 100)
Cout << "That number is acceptable.\n";
Else
Cout << "That number is not acceptable.\n";

A) 100
B) 10
C) 99
D) 0
E) All of these
سؤال
If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.
سؤال
Both of the following if statements perform the same operation.
if (sales > 10000)
commissionRate = 0.15;
if (sales > 10000) commissionRate = 0.15;
سؤال
You should be careful when using the equality operator to compare floating point values because of potential round-off errors.
سؤال
What is the output of the following code? int w = 98;
Int x = 99;
Int y = 0;
Int z = 1;
If (x >= 99)
{
If (x < 99)
Cout << y << endl;
Else
Cout << z << endl;
}
Else
{
If (x == 99)
Cout << x << endl;
Else
Cout << w << endl;
}

A) 98
B) 99
C) 0
D) 1
سؤال
What will be the value of result after the following code has been executed? int a = 60;
Int b = 15;
Int result = 10;
If (a = b)
Result *= 2;

A) 10
B) 120
C) 20
D) This code will not compile
سؤال
Which of the following expressions will determine whether x is less than or equal to y?

A) x > y
B) x =< y
C) x <= y
D) x >= y
سؤال
The following code correctly determines whether x contains a value in the range of 0 through 100.
if (x >= 0 && <= 100)
سؤال
If the sub-expression on the left side of an && operator is false, the expression on the right side will not be checked.
سؤال
As a rule of style, when writing an if statement you should indent the conditionally-executed statements.
سؤال
Which line in the following program will cause a compiler error? 1 #include
2 using namespace std;
3
4 int main()
5 {
6 int number = 5;
7
8 if (number >= 0 && <= 100)
9 cout << "passed.\n";
10 else
11 cout << "failed.\n";
12 return 0;
13 }

A) 6
B) 8
C) 10
D) 9
سؤال
An expression that has any value other than 0 is considered true by an if statement.
سؤال
The default section is required in a switch statement.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/53
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 4: Making Decisions
1
What will the following segment of code output? You can assume the user enters a grade of 90 from the keyboard. cout << "Enter a test score: ";
Cin >> test_score;
If (test_score < 60);
Cout << "You failed the test!" << endl;
If (test_score > 60)
Cout << "You passed the test!" << endl;
Else
Cout << "You need to study for the next test!";

A) You failed the test!
B) You passed the test!
C) You failed the test!
You passed the test!
D) You failed the test!
You did poorly on the test!
E) None of the above
C
2
This operator represents the logical AND.

A) ++
B) ||
C) &&
D) @
E) None of these
C
3
Relational operators allow you to ____________ numbers.

A) add
B) multiply
C) compare
D) average
E) None of these
C
4
After execution of the following code, what will be the value of input_value if the value 0 is entered at the keyboard at run time? cin >> input_value;
If (input_value > 5)
Input_value = input_value + 5;
Else if (input_value > 2)
Input_value = input_value + 10;
Else
Input_value = input_value + 15;

A) 15
B) 10
C) 25
D) 0
E) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
5
What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables. a = x >= y;

A) 10
B) 7
C) The string "x >= y"
D) 1
E) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the output of the following segment of code if 4 is input by the user when asked to enter a number? int num;
Int total = 0;
Cout << "Enter a number from 1 to 10: ";
Cin >> num;
Switch (num)
{
Case 1:
Case 2: total = 5;
Case 3: total = 10;
Case 4: total = total + 3;
Case 8: total = total + 6;
Default: total = total + 4;
}
Cout << total << endl;

A) 0
B) 3
C) 13
D) 28
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
7
What will be the output of the following code segment after the user enters 0 at the keyboard? int x = -1;
Cout << "Enter a 0 or a 1 from the keyboard: ";
Cin >> x;
If (x)
Cout << "true" << endl;
Else
Cout << "false" << endl;

A) Nothing will be displayed
B) false
C) x
D) true
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
8
When a relational expression is false, it has the value _____.

A) one
B) zero
C) zero, one, or minus one
D) less than zero
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
9
What will following segment of code output? int x = 5;
If (x = 2)
Cout << "This is true!" << endl;
Else
Cout << "This is false!" << endl;
Cout << "This is all folks!" << endl;

A) This is true!
B) This is false!
C) This is true!
This is false!
D) This is true!
This is all folks!
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
10
This statement lets the value of a variable or expression determine where the program will branch to.

A) switch
B) select
C) associative
D) scope
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
11
Whereas < is called a relational operator, x < y is called a(n)________________

A) Arithmetic operator
B) Relative operator
C) Relational expression
D) Largeness test
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
12
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

A) break
B) exit
C) switch
D) scope
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
13
This is a variable, usually a boolean or an integer, that signals when a condition exists.

A) relational operator
B) arithmetic operator
C) flag
D) float
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
14
Input values should always be checked for

A) Appropriate range
B) Reasonableness
C) Division by zero, if division is taking place
D) All of these
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
15
x <= (y * 2)

A) 3, 4, 6, 7 are False
B) Only 5 is False
C) 3 and 4 are False
D) All are False
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
16
This operator is used in C++ to represent equality.

A) =
B) ><
C) !!
D) ==
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
17
What will the following segment of code output? score = 40;
If (score > 95)
Cout << "Congratulations!\n";
Cout << "That's a high score!\n";
Cout << "This is a test question!" << endl;

A) This is a test question!
B) Congratulations!
That's a high score!
This is a test question!
C) That's a high score!
This is a test question!
D) Congratulations!
That's a high score!
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
18
When an if statement is placed within the conditionally-executed code of another if statement, this is known as:

A) complexity
B) overloading
C) nesting
D) validation
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
19
If you place a semicolon after the statement if (x < y)

A) The code will not compile.
B) The compiler will interpret the semicolon as a null statement.
C) The if statement will always evaluate to false.
D) All of the above.
E) None of these.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
20
This operator takes an operand and reverses its truth or falsehood.

A) ||
B) relational
C) arithmetic
D) !
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
21
This operator performs a logical NOT operation.

A) --
B) !
C) <>
D) ><
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
22
The default section of a switch statement performs a similar task as the _______ portion of an if/else if statement.

A) conditional
B) break
C) trailing else
D) All of these
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
23
What is the value of the following expression? true && false

A) true
B) false
C) -1
D) +1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
24
Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1;
Y = y + z;
X = x + y;
Cout << "result = "
<< (x < y ? y : x)
<< endl;

A) 0
B) 1
C) 2
D) 3
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which statement allows you to properly check the char variable code to determine whether it is equal to a "C" and then output "This is a check" and then advance to a new line?

A) if code is equal to C
Cout << "This is a check\n";
B) if (code = "C")
Cout << "This is a check" << endl;
)
C) if (code == 'C')
Cout << "This is a check\n";
D) if (code == C)
Cout << "This is a check" << endl;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
26
What will the following program display? #include
Using namespace std;
Int main()
{
Int a = 0, b = 2, x = 4, y = 0;
Cout << (a == b) << " ";
Cout << (a != b) << " ";
Cout << (b <=x) << " ";
Cout << (y > a) << endl;
Return 0;
}

A) 0 1 1 0
B) 0 0 1 0
C) 1 1 0 1
D) 1 0 0 1
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
27
In C++ the = operator indicates

A) equality
B) assignment
C) subtraction
D) negation
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
28
What is the value of the following expression? true && true

A) true
B) false
C) -1
D) +1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
29
The ________ of a variable is limited to the block in which it is declared.

A) precedence
B) associativity
C) scope
D) branching ability
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
30
What will the following segment of code output if 11 is entered at the keyboard? int number;
Cin >> number;
If (number > 0)
Cout << "C++";
Else
Cout << "Soccer";
Cout << " is ";
Cout << "fun" << endl;

A) C++ is fun
B) Soccer is fun
C) C++
D) C++fun
E) Soccerfun
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
31
What is the value of the following expression? false || true

A) true
B) false
C) -1
D) +1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
32
What is the value of donuts after the following code executes? int donuts = 10;
If (donuts = 1)
Donuts = 0;
Else
Donuts += 2;

A) 12
B) 10
C) 0
D) 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
33
When a program lets the user know that an invalid choice has been made, this is known as:

A) input validation
B) output correction
C) compiler criticism
D) output validation
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
34
What is the value of the following expression? true || true

A) true
B) false
C) -1
D) +1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
35
Given that x = 2, y = 1, and z = 0, what will the following cout statement display? cout << "answer = " << (x || !y && z) << endl;

A) answer = 0
B) answer = 1
C) answer = 2
D) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
36
These operators connect two or more relational expressions into one, or reverse the logic of an expression.

A) relational
B) logical
C) irrational
D) negation
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
37
This operator is known as the logical OR operator.

A) --
B) //
C) #
D) ||
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
38
What will the following program segment display? int funny = 7, serious = 15;
Funny = serious % 2;
If (funny != 1)
{
Funny = 0;
Serious = 0;
}
Else if (funny == 2)
{
Funny = 10;
Serious = 10;
}
Else
{
Funny = 1;
Serious = 1;
}
Cout << funny << " " << serious << endl;

A) 7 15
B) 0 0
C) 10 10
D) 1 1
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
39
If you intend to place a block of statements within an if statement, you must place these around the block.

A) parentheses ( )
B) square brackets [ ]
C) quotation marks ? ?
D) curly braces { }
E) None of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
40
What is the value of donuts after the following code executes? int donuts = 10;
If (donuts != 10)
Donuts = 0;
Else
Donuts += 2;

A) 12
B) 10
C) 0
D) 2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which value can be entered to cause the following code segment to display the message "That number is acceptable." int number;
Cin >> number;
If (number > 10 && number < 100)
Cout << "That number is acceptable.\n";
Else
Cout << "That number is not acceptable.\n";

A) 100
B) 10
C) 99
D) 0
E) All of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
42
If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
43
Both of the following if statements perform the same operation.
if (sales > 10000)
commissionRate = 0.15;
if (sales > 10000) commissionRate = 0.15;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
44
You should be careful when using the equality operator to compare floating point values because of potential round-off errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
45
What is the output of the following code? int w = 98;
Int x = 99;
Int y = 0;
Int z = 1;
If (x >= 99)
{
If (x < 99)
Cout << y << endl;
Else
Cout << z << endl;
}
Else
{
If (x == 99)
Cout << x << endl;
Else
Cout << w << endl;
}

A) 98
B) 99
C) 0
D) 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
46
What will be the value of result after the following code has been executed? int a = 60;
Int b = 15;
Int result = 10;
If (a = b)
Result *= 2;

A) 10
B) 120
C) 20
D) This code will not compile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following expressions will determine whether x is less than or equal to y?

A) x > y
B) x =< y
C) x <= y
D) x >= y
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
48
The following code correctly determines whether x contains a value in the range of 0 through 100.
if (x >= 0 && <= 100)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
49
If the sub-expression on the left side of an && operator is false, the expression on the right side will not be checked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
50
As a rule of style, when writing an if statement you should indent the conditionally-executed statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
51
Which line in the following program will cause a compiler error? 1 #include
2 using namespace std;
3
4 int main()
5 {
6 int number = 5;
7
8 if (number >= 0 && <= 100)
9 cout << "passed.\n";
10 else
11 cout << "failed.\n";
12 return 0;
13 }

A) 6
B) 8
C) 10
D) 9
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
52
An expression that has any value other than 0 is considered true by an if statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
53
The default section is required in a switch statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 53 في هذه المجموعة.