Exam 5: Making Decisions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The conditional operator, also called the ____________ provides another way to express a simple if...else selection statement.

(Short Answer)
4.9/5
(81)

When strings are compared, the first character in the first operand is compared against the first character in the second operand.

(True/False)
4.8/5
(77)

When you have a single variable being tested for equality against four or more values, a one-way selection statement is the most appropriate type of conditional expression to use.

(True/False)
4.8/5
(82)

With an if statement, when you place a semicolon on the line that has the conditional expression, you create a null (empty) statement body for the true portion of the if statement.

(True/False)
4.9/5
(72)

How can the compound conditional expression ((average > 79 && average <= 89)) be written to eliminate the logical operator - without changing the logic?

(Multiple Choice)
4.9/5
(73)

Forms of the if statement include one-way, two-way, ____________, multiway, and compound.

(Short Answer)
4.9/5
(76)

Boolean variables store 0 to represent off or false and 1 to represent on or true.

(True/False)
4.8/5
(76)

With a two-way if statement, either the true statement(s) is (are) executed or the false statement(s), or both.

(True/False)
4.8/5
(84)

if (amount > 1000)     result = 1; Else    if (amount > 500)       result = 2;    else       if (amount > 100)           result = 3;       else           result = 4; Using the above code segment, w hat is stored in result when amount is equal to 876?

(Multiple Choice)
4.7/5
(92)

Assignment operators appear at the top of the hierarchy in the operator precedence table.

(True/False)
4.8/5
(88)

Which of the following statements regarding curly braces is NOT correct as they relate to their use with an if statement?

(Multiple Choice)
4.8/5
(86)

Equality comparisons with floating-point and decimal types often produce unpredictable results.

(True/False)
4.8/5
(76)

The expression, (5 > 57 % 8), evaluates to ____.

(Multiple Choice)
4.8/5
(94)

A comparison to determine whether the uppercase character S is less than the uppercase character W produces false.

(True/False)
4.7/5
(79)

if (a > 10)    if (b > 10)       if (c > 10)           result =  1;       else           if (b > 100)              result = 2;           else Result = 3;     else       result = 4;   else     result = 5; What is stored in result when a is equal to zero, b and c are equal to 100?

(Multiple Choice)
4.9/5
(79)

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?

(Multiple Choice)
4.8/5
(89)

switch (phoneDigit) {     case 1:   num = 1;      break;     case 2:   num = 2;      break;     case 3:   num = 3;      break;     case 4:   num = 4;      break;     default:  num = 0;                  break; } Looking at the example above, when phoneDigit has a value of 'Q', what value is stored in num?

(Multiple Choice)
4.8/5
(64)

Relational operators allow you to test variables to see if one is greater or less than another variable or value.

(True/False)
4.9/5
(80)

____________ operators allow you to test variables to see if one is greater or less than another variable or value.

(Short Answer)
4.9/5
(78)

if (aValue < largest ) result = aValue; Else Result = largest; What happens when aValue is equal to largest in the program segment above?

(Multiple Choice)
4.8/5
(84)
Showing 21 - 40 of 75
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)