CIS220-Ch 5 Quiz Review – Flashcards
Unlock all answers in this set
Unlock answersquestion
if (examScore > 89) grade = 'A'; Console.WriteLine("Excellent"); Using the code snippet above, when does Excellent get displayed? a. when the score is less than or equal to 89 b. every time the program is run c. never, a syntax error is generated d. whenever the score is greater than 89
answer
Wrong Answer d. whenever the score is greater than 89
question
When you place an if statement within another if statement, ____. a. a syntax error is generated b. curly braces are required c. you create a switch statement d. you create a nested if statement
answer
you create a nested if statement
question
n C#, both the break and default are optional entries found with a switch statement.
answer
False
question
The logical operators in C# are ____. a. != and == b. ==, =, and != c. >, =, <= d. && and ||
answer
&& and ||
question
Assignment operators appear at the top of the hierarchy in the operator precedence table. T/F
answer
False
question
Which of the following statements regarding curly braces is NOT correct as they relate to their use with an if statement? a. They can be added to increase readability. b. They are required when there is more than one statement following the if or else. c. They can be used with the true statements and omitted with the false statements. d. They are used to block three or more statements.
answer
WRONG ANSWER They are required when there is more than one statement following the if or else. They can be used with the true statements and omitted with the false statements.
question
Selection statements must include a Boolean variable.
answer
False
question
How can the compound conditional expression ((average > 79 && average average 79 <= 89) d. remove the && and create a nested if statement
answer
WRONG ANSWER by replacing the && with ||
question
When you compare characters stored in char memory locations using relational operators, ____. a. you receive an error message b. they are compared lexicographically c. you get inconsistent results d. they are always considered equal
answer
WRONG ANSWER you receive an error message
question
Which of the following is NOT one of the basic programming constructs? a. simple sequence b. event c. iteration d. selection
answer
event
question
Iteration, also called selection is used for decision making and allows your program statements to deviate from the sequential path and perform different statements based on the value of an expression.
answer
False
question
____ perform differently based on their operands. a. Conditional expressions b. Boolean operators c. Overloaded operators d. Relational operators
answer
Overloaded Operators
question
The rule for lining up, or matching, elses is that the else is matched with the first if, from top to bottom.
answer
False
question
The conditional expression, sometimes called "the test," must evaluate to true.
answer
False
question
Using a single equal symbol inside a conditional expression, where a test was intended, causes a syntax error to be issued in C#
answer
True
question
When you compare characters stored in char memory locations using relational operators, ____. a. you receive an error message b. you get inconsistent results c. they are always considered equal d. they are compared lexicographically
answer
they are compared lexicographically
question
The conditional expression true || false produces false.
answer
False
question
Placing a semicolon onto the end of the conditional one-way if statement a. produces a syntax error b. causes the expression to evaluate to false c. produces a null empty bodied true statement d. causes the expression to evaluate to true
answer
WRONG ANSWER causes the expression to evaluate to false
question
An exclamation point followed by a single equal symbol (!=) represents not equal in C#.
answer
True
question
Class diagrams list the data field members in the center rectangle and the methods or behaviors in the bottom rectangle.
answer
True
question
A company issues $5,000.00 bonuses at the end of the year to all employees who earn less than $100,000. Salary and bonus are both defined as double data types. Which of the following selection statements would assign the correct amount to bonus? Answers: a. if (salary <= 100000) bonus = 5000; b. if (salary < 100000); bonus = $5000; c. if (salary < $100,000) bonus == $5000; d. if (salary < 100000) bonus = 5000;
answer
WRONG ANSWER if (salary < $100,000) bonus == $5000;
question
Selection statements must include a Boolean variable
answer
False
question
No fall through is permitted in C# if the previous case label has code.
answer
True
question
In C#, both the break and default are optional entries found with a switch statement.
answer
False
question
When strings are compared, the first character in the first operand is compared against the first character in the second operand.
answer
True