Exam 3: Decision Structures

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

What would be the value of discountRate after the following statements are executed? double discountRate = 0.0; Int purchase = 1250; If (purchase > 1000) DiscountRate = .05; If (purchase > 750) DiscountRate = .03; If (purchase > 500) DiscountRate = .01; Else DiscountRate = 0;

(Multiple Choice)
4.8/5
(36)

Which of the following will format 12.78 to display as 012.8?

(Multiple Choice)
4.8/5
(39)

In a switch statement,if two different values for the CaseExpression would result in the same code being executed,you must have two copies of the code,one after each CaseExpression.

(True/False)
4.8/5
(33)

What is the value of ans after the following code has been executed? int x = 35; Int y = 20,ans = 80; If (x < y); Ans += y;

(Multiple Choice)
4.8/5
(32)

In an if/else statement,if the boolean expression is false,

(Multiple Choice)
4.7/5
(37)

What will be the value of ans after the following code has been executed? int x = 90,y = 55,ans = 10; If ( x == y); Ans *= 2;

(Multiple Choice)
4.9/5
(34)

Which of the following is the correct boolean expression to test for: int x being a value less than or equal to 500 or greater than 650,and int y not equal to 1000?

(Multiple Choice)
4.9/5
(34)

If str1 and str2 are both Strings,which of the following will correctly test to determine whether str1 is less than str2? (1)(str1 < str2) (2)(str1.equals(str2)< 0) (3)(str1.compareTo(str2)< 0)

(Multiple Choice)
4.8/5
(43)

Which of the following will format .1278 to display as 12.8%?

(Multiple Choice)
4.9/5
(37)

Which of the following is the correct boolean expression to test for: int x being a value between,but not including,500 and 650,or int y not equal to 1000?

(Multiple Choice)
4.8/5
(44)

An important style rule you should adopt for writing if statements is to write the conditionally executed statement on the line after the if statement.

(True/False)
4.8/5
(35)

The _________ statement is used to make simple decisions in Java.

(Multiple Choice)
4.8/5
(35)
Showing 41 - 52 of 52
close modal

Filters

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