Deck 3: Control Statements, Part 1
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/27
العب
ملء الشاشة (f)
Deck 3: Control Statements, Part 1
1
What is wrong with the following while loop?
While sum <= 1000 )
Sum = sum - 30;
A) The parentheses should be braces.
B) Braces are required around sum = sum - 30;.
C) There should be a semicolon after while sum <= 1000 ).
D) sum = sum - 30 should be sum = sum + 30 or else the loop may never end.
While sum <= 1000 )
Sum = sum - 30;
A) The parentheses should be braces.
B) Braces are required around sum = sum - 30;.
C) There should be a semicolon after while sum <= 1000 ).
D) sum = sum - 30 should be sum = sum + 30 or else the loop may never end.
D
2
In indefinite repetition, an input value:
A) Should always be evaluated before being processed.
B) Should always be processed directly after it is entered.
C) Should never be modified.
D) Can be entered, processed, and evaluated in any order.
A) Should always be evaluated before being processed.
B) Should always be processed directly after it is entered.
C) Should never be modified.
D) Can be entered, processed, and evaluated in any order.
A
3
The data type bool:
A) Can take on values true and false.
B) Can take on any expression as a value.
C) Can take on values -1, 0 or 1.
D) Can only be used in a selection statement.
A) Can take on values true and false.
B) Can take on any expression as a value.
C) Can take on values -1, 0 or 1.
D) Can only be used in a selection statement.
A
4
Which operation does not take place in the following example?
Int x = 21;
Double y = 6;
Double z = 14;
Y = x / z;
X = 5.5 * y;
A) Implicit conversion.
B) Promotion.
C) Explicit conversion.
D) Truncation.
Int x = 21;
Double y = 6;
Double z = 14;
Y = x / z;
X = 5.5 * y;
A) Implicit conversion.
B) Promotion.
C) Explicit conversion.
D) Truncation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
5
An uninitialized local variable contains:
A) The value last stored in the memory location reserved for that variable.
B) No value.
C) A value of zero.
D) A randomly assigned value.
A) The value last stored in the memory location reserved for that variable.
B) No value.
C) A value of zero.
D) A randomly assigned value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following is a double-selection statement?
A) if.
B) if…else.
C) do…while.
D) switch.
A) if.
B) if…else.
C) do…while.
D) switch.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
7
If grade has the value of 60, what will the following code display?
If grade >= 60 )
Cout << "Passed";
A) nothing.
B) 60
C) Passed
D) cout << "Passed";
If grade >= 60 )
Cout << "Passed";
A) nothing.
B) 60
C) Passed
D) cout << "Passed";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
8
Indefinite repetition is controlled by a:
A) Counter.
B) Sentinel value.
C) Absence of a condition.
D) Non-constant condition.
A) Counter.
B) Sentinel value.
C) Absence of a condition.
D) Non-constant condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following encompasses the other three?
A) Sequence structure.
B) Repetition structure.
C) Control structure.
D) Selection structure.
A) Sequence structure.
B) Repetition structure.
C) Control structure.
D) Selection structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
10
Using a while loop's counter-control variable in a calculation after the loop ends often causes a common logic error called:
A) A fatal logic error.
B) A counter exception.
C) A syntax error.
D) An off-by-one error.
A) A fatal logic error.
B) A counter exception.
C) A syntax error.
D) An off-by-one error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
11
What is the final value of x after performing the following operations?
Int x = 21;
Double y = 6;
Double z = 14;
Y = x / z;
X = 5.5 * y;
A) 8.25
B) 5.5
C) 5
D) 8
Int x = 21;
Double y = 6;
Double z = 14;
Y = x / z;
X = 5.5 * y;
A) 8.25
B) 5.5
C) 5
D) 8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following is true of pseudocode?
A) It's executed by the computer.
B) It helps the programmer "think out" a program.
C) It includes declarations and all types of statements.
D) All of the above are false.
A) It's executed by the computer.
B) It helps the programmer "think out" a program.
C) It includes declarations and all types of statements.
D) All of the above are false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
13
A block:
A) Must contain exactly three statements.
B) Cannot contain declarations.
C) Is a compound statement.
D) Is represented by placing a semicolon ;) where a statement would normally be.
A) Must contain exactly three statements.
B) Cannot contain declarations.
C) Is a compound statement.
D) Is represented by placing a semicolon ;) where a statement would normally be.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
14
The conditional operator ?:):
A) Is the only ternary operator in C++.
B) Is a unary operator.
C) Associates from left to right.
D) Accepts two operands.
A) Is the only ternary operator in C++.
B) Is a unary operator.
C) Associates from left to right.
D) Accepts two operands.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following is a repetition statement?
A) if.
B) if…else.
C) do…while.
D) switch.
A) if.
B) if…else.
C) do…while.
D) switch.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
16
How many times will the following loop print hello?
I = 1;
While i <= 10 )
Cout << "hello";
A) 0.
B) 9.
C) 10.
D) An infinite number of times.
I = 1;
While i <= 10 )
Cout << "hello";
A) 0.
B) 9.
C) 10.
D) An infinite number of times.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
17
Display correct if answer is equal to 7 and incorrect if answer is not equal to 7?
A) if answer == 7 ) cout << "correct";
Else
Cout << "incorrect";
B) cout << answer == 7 ? "correct" : "incorrect";
C) cout << answer == 7 ? "correct" : "incorrect" );
D) answer == 7 ? cout << "correct" : cout << "incorrect";
A) if answer == 7 ) cout << "correct";
Else
Cout << "incorrect";
B) cout << answer == 7 ? "correct" : "incorrect";
C) cout << answer == 7 ? "correct" : "incorrect" );
D) answer == 7 ? cout << "correct" : cout << "incorrect";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
18
In an activity diagram for an algorithm, what does a solid circle surrounded by a hollow circle represent?
A) Initial state.
B) Final state.
C) Action state.
D) Transition.
A) Initial state.
B) Final state.
C) Action state.
D) Transition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
19
Pseudocode does not include:
A) Declarations.
B) Input/output.
C) Algorithms.
D) Control structures.
A) Declarations.
B) Input/output.
C) Algorithms.
D) Control structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
20
Specifying the order in which statements are to be executed in a computer program is called:
A) An algorithm.
B) Transfer of control.
C) Program control.
D) Pseudocode.
A) An algorithm.
B) Transfer of control.
C) Program control.
D) Pseudocode.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following operations has the highest precedence?
A) Postincrement.
B) Multiplication.
C) Addition.
D) Assignment.
A) Postincrement.
B) Multiplication.
C) Addition.
D) Assignment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
22
Assuming that x is equal to 4, which of the following statements will not result in y containing the value 5 after execution?
A) y = 5;
B) y = x++;
C) y = ++x;
D) y = x + 1
A) y = 5;
B) y = x++;
C) y = ++x;
D) y = x + 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
23
To handle situations where a loop must reinitialize a variable at the beginning of each iteration, such re-initialization could be performed by:
A) An assignment statement before the loop body.
B) A declaration inside the loop body.
C) An assignment statement after the loop body.
D) A declaration after the loop body.
A) An assignment statement before the loop body.
B) A declaration inside the loop body.
C) An assignment statement after the loop body.
D) A declaration after the loop body.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following will not increment c by 1?
A) c + 1;
B) c++;
C) ++c;
D) c += 1;
A) c + 1;
B) c++;
C) ++c;
D) c += 1;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
25
Assuming that x and y are equal to 3 and 2, respectively, after the statement x -= y executes, the values of x and y will be:
A) x: 5; y: 3
B) x: 3; y: -1
C) x: 3; y: 5
D) x: 1; y: 2
A) x: 5; y: 3
B) x: 3; y: -1
C) x: 3; y: 5
D) x: 1; y: 2
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
26
Having a loop within a loop is known as:
A) Recursion.
B) Doubling up.
C) Nesting.
D) Stacking.
A) Recursion.
B) Doubling up.
C) Nesting.
D) Stacking.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck
27
If x initially contains the value 3, which of the following sets x to 7?
A) x ++ 4;
B) x += 4;
C) x =+ 4;
D) x + 4 = x;
A) x ++ 4;
B) x += 4;
C) x =+ 4;
D) x + 4 = x;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 27 في هذه المجموعة.
فتح الحزمة
k this deck