Exam 15: Making Decisions

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

What are four of the most frequent errors new programmers make when they first learn to make decisions?

(Essay)
4.8/5
(33)

What type of structure involves choosing between alternative courses of action based on some value within a program?

(Multiple Choice)
4.9/5
(37)

Explain why the following code sample does not capture the intent of the request "Make sure if the sales code is not 'A' or 'B', the customer gets a 10% discount".What is the correct if statement? if(salesCode != 'A' || salesCode != 'B') discount = 0.10;

(Essay)
4.8/5
(37)

What conditional operator can be used to create a compound Boolean expression as an alternative to if statements?

(Multiple Choice)
4.8/5
(35)

List the four keywords used in a switch structure and provide a brief description of each.

(Essay)
4.8/5
(36)

In a switch statement, the keyword return usually terminates each case.

(True/False)
4.8/5
(34)

What character(s) function as the non-conditional Boolean logical inclusive OR operator?

(Multiple Choice)
4.9/5
(34)

Flowchart creators use diamond shapes to indicate alternative courses of action.

(True/False)
4.7/5
(34)

In a situation where you want to perform one action when a Boolean expression evaluates as true and an alternate action when it evaluates as false, otherwise known as a dual-alternative decision, what sort of statement should you use?

(Multiple Choice)
4.8/5
(42)

Why are all computer decisions true-or-false decisions?

(Essay)
4.9/5
(40)

What should you use if you wish to execute two or more statements conditionally?

(Multiple Choice)
5.0/5
(38)

Explain (in words) how bonuses are assigned in the following example: if(saleAmount > 1000) if(saleAmount < 2000) bonus = 100; else bonus = 50;

(Essay)
4.8/5
(27)

The if expression that precedes a block in a decision structure is known as what type of statement?

(Multiple Choice)
4.9/5
(33)

The following range-checking code works but is somewhat inefficient.Explain why and show how to revise it to be more efficient. if (saleAmount >= 1000) commissionRate = 0.08; else if (saleAmount >= 500) commissionRate = 0.06; else if (saleAmount <= 499) commissionRate = 0.05;

(Essay)
4.7/5
(41)

Describe how short-circuit evaluation works when evaluating compound Boolean expressions.Show an example.

(Essay)
4.8/5
(39)

What character(s) function as the non-conditional Boolean logical AND operator in the C# programming language?

(Multiple Choice)
4.8/5
(32)

What rule results in an error if you reach the end point of a statement list in a case section?

(Multiple Choice)
5.0/5
(46)

It is illegal to use a block to contain a single statement.

(True/False)
4.7/5
(34)

In a switch statement, what keyword is followed by one of the possible values that might equal the switch expression?

(Multiple Choice)
4.7/5
(35)

Placing the opening brace of an if block on the same line as the if statement is known as what style of programming?

(Multiple Choice)
4.9/5
(45)
Showing 21 - 40 of 40
close modal

Filters

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