Deck 5: Control Statements: Part 1

Full screen (f)
exit full mode
Question
Which statement is false

A) Unless directed otherwise, the computer executes C# statements one after the other in the order in which they are written.
B) Activity diagrams normally show the C# code that implements the activity.
C) Like pseudocode, activity diagrams help programmers develop and represent algorithms.
D) The arrows in the activity diagram represent transitions, which indicate the order in which the actions represented by the action states occur.
Use Space or
up arrow
down arrow
to flip the card.
Question
Which of the following is a double-selection control statement

A) do…while
B) for
C) if…else
D) if
Question
Control statements are helpful in building and manipulating objects.
Question
Pseudocode helps you conceptualize a program during the design process.
Question
Pseudocode must be written in an editor capable of understanding it and the language to which it pertains.
Question
What kind of language is pseudocode

A) a hybrid language of all .NET languages
B) an artificial language used to develop algorithms
C) a language used to translate from C++ to C#
D) None of the above.
Question
Which of the following is not an algorithm

A) a recipe
B) operating instructions
C) textbook index
D) shampoo instructions (lather, rinse, repeat)
Question
A transfer of control occurs when:

A) a program changes from input to output, or vice versa
B) a logic error occurs in a program
C) a statement other than the next one in the program executes
D) None of the above.
Question
Pseudocode is most comparable to which of the following languages

A) C#
B) C
C) Pascal
D) English
Question
The order of actions of an algorithm is irrelevant.
Question
The three types of selection structures are:

A) foreach, for and switch
B) if, for and switch
C) if, if/else and while
D) if, if/else and switch
Question
It is essential to have an understanding of a problem before writing a program to solve it.
Question
Programs can be written,compiled and executed with pseudocode.
Question
Pseudocode normally describes only executable statements.
Question
The lines in an activity diagram are a graphical representation of an algorithm.
Question
Which of the following is not a benefit of "goto-free programs"

A) easier to debug and modify
B) shorter
C) clearer
D) more likely to be bug free
Question
Program control is best defined as:

A) specifying the degree of control a program has over the computer it is executed on
B) specifying the line of code that is executing at a given time
C) specifying the order in which the statements are executed
D) None of the above.
Question
Sequential execution is when statements execute one after the other in the order in which they appear in the program.
Question
Which of the following is a type of control structure

A) declaration structure
B) repetition structure
C) flow structure
D) All of the above.
Question
What is an algorithm

A) the actions (and their order) that solve a particular problem
B) an English description of a problem to be solved
C) the process of converting between data types
D) None of the above.
Question
The sequence structure is built into C#.Unless directed otherwise,the computer ex
ecutes C# statements one after the other in the order in which they are written.
Question
The best way to use braces is to go back and insert them after all the code has been written.
Question
What is output by the following C# code segment
Int temp = 200;
If (temp > 90)
{
Console.WriteLine("This porridge is too hot.");
}
If (temp < 70)
{
Console.WriteLine("This porridge is too cold.");
}
If (temp == 80)
{
Console.WriteLine("This porridge is just right!");
}

A) This porridge is too hot.
B) This porridge is too cold.
C) This porridge is just right!
D) None of the above.
Question
A set of statements contained in a pair of braces can be placed anywhere in a program at which a single statement can be placed.
Question
A decision symbol in an activity diagram takes the shape of a ________.

A) diamond
B) rectangle
C) circle
D) question mark
Question
The first operand of the ternary operator is the condition.
Question
The conditional operator is of the highest precedence.
Question
Control structures cannot be placed inside other control structures.
Question
if is a _________ statement.

A) restricted
B) selection
C) repetition
D) unrestricted
Question
What capability does if…else provide that if does not

A) the ability to execute actions when the condition is true and false
B) the ability to nest structures
C) the ability to stack structures
D) None of the above.
Question
is C#'s only ternary operator.

A) *
B)
C) =
D) //
Question
C#'s type is capable of holding the value true or false.

A) bool
B) int
C) if
D) logic
Question
Syntax errors cause a program to fail and terminate prematurely.
Question
The if statement is a repetition statement.
Question
The body of an if statement executes only if the condition is evaluated as true.
Question
Which of the following statements about the conditional operator (
:)is false

A) The conditional operator is a ternary operator, meaning that it takes three operands.
B) The first operand is a bool expression.
C) The second operand is the result value if the condition evaluates to false.
D) The second operand is the result value if the condition evaluates to true.
Question
A selection statement chooses among alternative courses of action.
Question
Which of the following is not included in an activity diagram for a control statement

A) transition arrows
B) attribute
C) action state
D) decision symbols
Question
The C# compiler always associates an else with the previous if,unless braces indicate otherwise.
Question
During the 1960s,it became clear that the indiscriminate use of transfers of control was the root of much difficulty experienced by software development groups.
Question
Counter-controlled repetition is also known as:

A) definite repetition
B) indefinite repetition
C) multiple-repetition structure
D) double-repetition structure
Question
It is known as when the number of repetitions is known before a loop begins executing.

A) definite repetition
B) infinite repetition
C) total repetition
D) None of the above.
Question
What is output by the following C# code segment
Int temp = 180;
While (temp != 80)
{
If (temp > 90)
{
Console.Write("This porridge is too hot! ");
// cool down
Temp = temp - (temp > 150
100 : 20);
}
Else
{
If (temp < 70)
{
Console.Write("This porridge is too cold! ");
// warm up
Temp = temp + (temp < 50
30 : 20);
}
}
}
If (temp == 80)
{
Console.WriteLine("This porridge is just right!");
}

A) This porridge is too cold! This porridge is just right!
B) This porridge is too hot! This porridge is just right!
C) This porridge is just right!
D) None of the above.
Question
How many times is the body of the loop below executed
Int counter = 1;
While (counter > 20)
{
// body of loop
Counter = counter + 1;
}

A) 19
B) 20
C) 21
D) 0
Question
Variables that store totals should generally be initialized to zero before being used in a program.
Question
Repetition in which the number of iterations is unknown before the loop begins executing is called ________.

A) indefinite repetition
B) controlled repetition
C) top-down repetition
D) None of the above.
Question
A can be used in repetition structures to indicate the end of data entry.

A) counter
B) boolean
C) sentinel value
D) None of the above.
Question
Which of the following is not necessarily an error (either a syntax error or a logic error)

A) Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false.
B) Spelling a key word (such as while or if) with a capitalized first letter.
C) Using a condition for a while statement that is initially false.
D) An infinite loop.
Question
The while statement is an example of a sequence structure.
Question
Which of the following terms is not used to refer to a sentinel value that breaks out of a while statement

A) signal value
B) break value
C) dummy value
D) flag value
Question
Floating-point numbers contain a fractional part and can be represented by the data type.

A) frac
B) real
C) double
D) None of the above.
Question
Which of the following is not one of the three phases that a program is typically split into using pseudocode

A) termination phase
B) initialization phase
C) processing phase
D) action phase
Question
A variable used only within a repetition statement should be declared within the statement.
Question
A while statement allows you to specify that an action should repeat while:

A) a specific condition remains false
B) a specific condition remains true
C) a specific condition remains either true or false
D) None of the above.
Question
A while statement can cause logic errors where the body never stops exe
Cuting.This is known as a(n)      

A) syntax error
B) fatal error
C) infinite loop
D) None of the above.
Question
Counter-controlled repetition is often called definite repetition because the number of repetitions is known before the loop begins executing.
Question
int division may yield a non-int result.
Question
Which of the following conditions would cause a while statement to stop executing

A) 3 < = 11
B) !(7 != 14)
C) 6 != 9
D) All of the above.
Question
A can be used in a repetition structure to control the number of times a set of statements will execute.

A) declaration
B) counter
C) controller
D) None of the above.
Question
In an activity diagram,the merge symbol has the same shape as what other symbol

A) decision symbol
B) action symbol
C) transition arrows
D) initial state
Question
The cast operator is formed by enclosing a type name in braces.
Question
C# rounds fractional values when they're to be stored in an integer variable.
Question
Cast operators are used to perform implicit conversions between data types.
Question
When using top-down,stepwise refinement,only the last refinement is a com
plete specification of the algorithm.
Question
A flag value should not be a legitimate data entry value.
Question
Which of the following operators associates from left to right

A) ++
B)
C) %=
D) /
Question
Which of the following generates a syntax error

A) c *= 3;
B) c %= 2;
C) c /= 4;
D) None of the above.
Question
Many algorithms can be divided into an initialization phase,a processing phase and a termination phase.
Question
The sentinel value must be chosen so that it cannot be confused with an acceptable in
put value.
Question
Which of the following correctly represents the expression a = a + 3

A) 3a
B) a += 3
C) a + 3
D) None of the above.
Question
Which statement is true

A) A while statement cannot be nested inside another while statement.
B) An if statement cannot be nested inside another if statement.
C) A while statement cannot be nested inside an if statement.
D) None of the above.
Question
When you know how many times a loop will execute in advance,a ________loop should be used.

A) sentinel
B) infinite
C) counter-controlled
D) None of the above.
Question
Top-down,stepwise refinement helps lead to well-structured algorithms.
Question
Which of the following segments will call the method readData four times

A) int k; k = 1;
While (k < 4)
{
ReadData();
K = k + 1;
}
B) int i;
C) int i;
D) int i; i = 0;
While (i < 4)
{
ReadData();
I = i + 1;
}
Question
What is typically the most difficult part of solving a problem on a computer

A) deciding what problem needs to be solved
B) developing the algorithm for the solution
C) producing a C# program from the algorithm
D) None of the above.
Question
Local variables must be ________.

A) initialized when they are declared.
B) initialized before their values are used in an expression.
C) declared and initialized in two steps.
D) declared at the top of the method.
Question
Which statement is false

A) To ensure that the operands are of the same type, C# performs implicit conversion on selected operands.
B) Cast operators are unary operators.
C) Cast operators associate from right to left and are one level lower than the multiplicative operators.
D) Cast operators are formed by placing parentheses around the name of a type.
Question
In an expression containing values of the types int and double,the ________ values are ________ to ________ values for use in the expression.

A) int, promoted, double.
B) int, demoted, double.
C) double, promoted, int.
D) double, demoted, int.
Question
What does the expression x %= 10 do

A) Adds 10 to the value of x, and stores the result in x.
B) Divides x by 10 and stores the remainder in x.
C) Divides x by 10 and stores the integer result in x.
D) None of the above.
Question
Using top-down,stepwise refinement results in pseudocode that can be straightforwardly evolved into a C# program.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/94
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 5: Control Statements: Part 1
1
Which statement is false

A) Unless directed otherwise, the computer executes C# statements one after the other in the order in which they are written.
B) Activity diagrams normally show the C# code that implements the activity.
C) Like pseudocode, activity diagrams help programmers develop and represent algorithms.
D) The arrows in the activity diagram represent transitions, which indicate the order in which the actions represented by the action states occur.
B
2
Which of the following is a double-selection control statement

A) do…while
B) for
C) if…else
D) if
C
3
Control statements are helpful in building and manipulating objects.
True
4
Pseudocode helps you conceptualize a program during the design process.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
5
Pseudocode must be written in an editor capable of understanding it and the language to which it pertains.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
6
What kind of language is pseudocode

A) a hybrid language of all .NET languages
B) an artificial language used to develop algorithms
C) a language used to translate from C++ to C#
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following is not an algorithm

A) a recipe
B) operating instructions
C) textbook index
D) shampoo instructions (lather, rinse, repeat)
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
8
A transfer of control occurs when:

A) a program changes from input to output, or vice versa
B) a logic error occurs in a program
C) a statement other than the next one in the program executes
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
9
Pseudocode is most comparable to which of the following languages

A) C#
B) C
C) Pascal
D) English
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
10
The order of actions of an algorithm is irrelevant.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
11
The three types of selection structures are:

A) foreach, for and switch
B) if, for and switch
C) if, if/else and while
D) if, if/else and switch
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
12
It is essential to have an understanding of a problem before writing a program to solve it.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
13
Programs can be written,compiled and executed with pseudocode.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
14
Pseudocode normally describes only executable statements.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
15
The lines in an activity diagram are a graphical representation of an algorithm.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is not a benefit of "goto-free programs"

A) easier to debug and modify
B) shorter
C) clearer
D) more likely to be bug free
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
17
Program control is best defined as:

A) specifying the degree of control a program has over the computer it is executed on
B) specifying the line of code that is executing at a given time
C) specifying the order in which the statements are executed
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
18
Sequential execution is when statements execute one after the other in the order in which they appear in the program.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following is a type of control structure

A) declaration structure
B) repetition structure
C) flow structure
D) All of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
20
What is an algorithm

A) the actions (and their order) that solve a particular problem
B) an English description of a problem to be solved
C) the process of converting between data types
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
21
The sequence structure is built into C#.Unless directed otherwise,the computer ex
ecutes C# statements one after the other in the order in which they are written.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
22
The best way to use braces is to go back and insert them after all the code has been written.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
23
What is output by the following C# code segment
Int temp = 200;
If (temp > 90)
{
Console.WriteLine("This porridge is too hot.");
}
If (temp < 70)
{
Console.WriteLine("This porridge is too cold.");
}
If (temp == 80)
{
Console.WriteLine("This porridge is just right!");
}

A) This porridge is too hot.
B) This porridge is too cold.
C) This porridge is just right!
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
24
A set of statements contained in a pair of braces can be placed anywhere in a program at which a single statement can be placed.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
25
A decision symbol in an activity diagram takes the shape of a ________.

A) diamond
B) rectangle
C) circle
D) question mark
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
26
The first operand of the ternary operator is the condition.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
27
The conditional operator is of the highest precedence.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
28
Control structures cannot be placed inside other control structures.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
29
if is a _________ statement.

A) restricted
B) selection
C) repetition
D) unrestricted
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
30
What capability does if…else provide that if does not

A) the ability to execute actions when the condition is true and false
B) the ability to nest structures
C) the ability to stack structures
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
31
is C#'s only ternary operator.

A) *
B)
C) =
D) //
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
32
C#'s type is capable of holding the value true or false.

A) bool
B) int
C) if
D) logic
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
33
Syntax errors cause a program to fail and terminate prematurely.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
34
The if statement is a repetition statement.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
35
The body of an if statement executes only if the condition is evaluated as true.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following statements about the conditional operator (
:)is false

A) The conditional operator is a ternary operator, meaning that it takes three operands.
B) The first operand is a bool expression.
C) The second operand is the result value if the condition evaluates to false.
D) The second operand is the result value if the condition evaluates to true.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
37
A selection statement chooses among alternative courses of action.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following is not included in an activity diagram for a control statement

A) transition arrows
B) attribute
C) action state
D) decision symbols
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
39
The C# compiler always associates an else with the previous if,unless braces indicate otherwise.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
40
During the 1960s,it became clear that the indiscriminate use of transfers of control was the root of much difficulty experienced by software development groups.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
41
Counter-controlled repetition is also known as:

A) definite repetition
B) indefinite repetition
C) multiple-repetition structure
D) double-repetition structure
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
42
It is known as when the number of repetitions is known before a loop begins executing.

A) definite repetition
B) infinite repetition
C) total repetition
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
43
What is output by the following C# code segment
Int temp = 180;
While (temp != 80)
{
If (temp > 90)
{
Console.Write("This porridge is too hot! ");
// cool down
Temp = temp - (temp > 150
100 : 20);
}
Else
{
If (temp < 70)
{
Console.Write("This porridge is too cold! ");
// warm up
Temp = temp + (temp < 50
30 : 20);
}
}
}
If (temp == 80)
{
Console.WriteLine("This porridge is just right!");
}

A) This porridge is too cold! This porridge is just right!
B) This porridge is too hot! This porridge is just right!
C) This porridge is just right!
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
44
How many times is the body of the loop below executed
Int counter = 1;
While (counter > 20)
{
// body of loop
Counter = counter + 1;
}

A) 19
B) 20
C) 21
D) 0
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
45
Variables that store totals should generally be initialized to zero before being used in a program.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
46
Repetition in which the number of iterations is unknown before the loop begins executing is called ________.

A) indefinite repetition
B) controlled repetition
C) top-down repetition
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
47
A can be used in repetition structures to indicate the end of data entry.

A) counter
B) boolean
C) sentinel value
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
48
Which of the following is not necessarily an error (either a syntax error or a logic error)

A) Neglecting to include an action in the body of a while statement that will eventually cause the condition to become false.
B) Spelling a key word (such as while or if) with a capitalized first letter.
C) Using a condition for a while statement that is initially false.
D) An infinite loop.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
49
The while statement is an example of a sequence structure.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
50
Which of the following terms is not used to refer to a sentinel value that breaks out of a while statement

A) signal value
B) break value
C) dummy value
D) flag value
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
51
Floating-point numbers contain a fractional part and can be represented by the data type.

A) frac
B) real
C) double
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
52
Which of the following is not one of the three phases that a program is typically split into using pseudocode

A) termination phase
B) initialization phase
C) processing phase
D) action phase
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
53
A variable used only within a repetition statement should be declared within the statement.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
54
A while statement allows you to specify that an action should repeat while:

A) a specific condition remains false
B) a specific condition remains true
C) a specific condition remains either true or false
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
55
A while statement can cause logic errors where the body never stops exe
Cuting.This is known as a(n)      

A) syntax error
B) fatal error
C) infinite loop
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
56
Counter-controlled repetition is often called definite repetition because the number of repetitions is known before the loop begins executing.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
57
int division may yield a non-int result.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
58
Which of the following conditions would cause a while statement to stop executing

A) 3 < = 11
B) !(7 != 14)
C) 6 != 9
D) All of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
59
A can be used in a repetition structure to control the number of times a set of statements will execute.

A) declaration
B) counter
C) controller
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
60
In an activity diagram,the merge symbol has the same shape as what other symbol

A) decision symbol
B) action symbol
C) transition arrows
D) initial state
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
61
The cast operator is formed by enclosing a type name in braces.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
62
C# rounds fractional values when they're to be stored in an integer variable.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
63
Cast operators are used to perform implicit conversions between data types.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
64
When using top-down,stepwise refinement,only the last refinement is a com
plete specification of the algorithm.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
65
A flag value should not be a legitimate data entry value.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
66
Which of the following operators associates from left to right

A) ++
B)
C) %=
D) /
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
67
Which of the following generates a syntax error

A) c *= 3;
B) c %= 2;
C) c /= 4;
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
68
Many algorithms can be divided into an initialization phase,a processing phase and a termination phase.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
69
The sentinel value must be chosen so that it cannot be confused with an acceptable in
put value.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
70
Which of the following correctly represents the expression a = a + 3

A) 3a
B) a += 3
C) a + 3
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
71
Which statement is true

A) A while statement cannot be nested inside another while statement.
B) An if statement cannot be nested inside another if statement.
C) A while statement cannot be nested inside an if statement.
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
72
When you know how many times a loop will execute in advance,a ________loop should be used.

A) sentinel
B) infinite
C) counter-controlled
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
73
Top-down,stepwise refinement helps lead to well-structured algorithms.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
74
Which of the following segments will call the method readData four times

A) int k; k = 1;
While (k < 4)
{
ReadData();
K = k + 1;
}
B) int i;
C) int i;
D) int i; i = 0;
While (i < 4)
{
ReadData();
I = i + 1;
}
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
75
What is typically the most difficult part of solving a problem on a computer

A) deciding what problem needs to be solved
B) developing the algorithm for the solution
C) producing a C# program from the algorithm
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
76
Local variables must be ________.

A) initialized when they are declared.
B) initialized before their values are used in an expression.
C) declared and initialized in two steps.
D) declared at the top of the method.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
77
Which statement is false

A) To ensure that the operands are of the same type, C# performs implicit conversion on selected operands.
B) Cast operators are unary operators.
C) Cast operators associate from right to left and are one level lower than the multiplicative operators.
D) Cast operators are formed by placing parentheses around the name of a type.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
78
In an expression containing values of the types int and double,the ________ values are ________ to ________ values for use in the expression.

A) int, promoted, double.
B) int, demoted, double.
C) double, promoted, int.
D) double, demoted, int.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
79
What does the expression x %= 10 do

A) Adds 10 to the value of x, and stores the result in x.
B) Divides x by 10 and stores the remainder in x.
C) Divides x by 10 and stores the integer result in x.
D) None of the above.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
80
Using top-down,stepwise refinement results in pseudocode that can be straightforwardly evolved into a C# program.
Unlock Deck
Unlock for access to all 94 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 94 flashcards in this deck.