Exam 3: Decision Structures

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

The System.out.printf method formats a string and displays it in the console window.

Free
(True/False)
4.7/5
(42)
Correct Answer:
Verified

True

If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?

Free
(Multiple Choice)
4.9/5
(43)
Correct Answer:
Verified

C

Which of the following statements determines whether the variable temp is within the range of 0 through 100 (inclusive)?

Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
Verified

A

In an if-else statement, if the boolean expression is false then

(Multiple Choice)
4.7/5
(48)

A __________ is a boolean variable that signals when some condition exists in the program.

(Multiple Choice)
4.9/5
(40)

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.7/5
(35)

When testing for character values, the switch statement does not test for the case of the character.

(True/False)
4.8/5
(41)

What does the following code display? double x = 12.3798146; System.out.printf("%.2f\n", x);

(Multiple Choice)
5.0/5
(42)

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, or int y not equal to 1000?

(Multiple Choice)
4.9/5
(40)

What will be the value of discountRate after the following statements are executed? double discountRate; Char custType = 'B'; Switch (custType) { Case 'A': DiscountRate = 0.08; Break; Case 'B': DiscountRate = 0.06; Case 'C': DiscountRate = 0.04; Default: DiscountRate = 0.0; }

(Multiple Choice)
4.9/5
(35)

The __________ statement is used to create a decision structure which allows a program to have more than one path of execution.

(Multiple Choice)
4.9/5
(47)

What would be the value of bonus after the following statements are executed? int bonus, sales = 1250; If (sales > 1000) Bonus = 100; If (sales > 750) Bonus = 50; If (sales > 500) Bonus = 25; Else Bonus = 0;

(Multiple Choice)
5.0/5
(41)

When testing for character values, the switch statement does not test for the case of the character.

(True/False)
4.8/5
(43)

What does the following code display? int d = 9, e = 12; System.out.printf("%d %d\n", d, e);

(Multiple Choice)
4.9/5
(28)

Unicode is an international encoding system that is extensive enough to represent all the characters of all the world's alphabets.

(True/False)
4.9/5
(31)

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

(Multiple Choice)
4.9/5
(39)

The String.format method works exactly like the System.out.printf method, except that it does not display the formatted string on the screen.

(True/False)
4.7/5
(41)

A local variable's scope always ends at the closing brace of the block of code in which it is declared.

(True/False)
4.8/5
(39)

All it takes for an OR expression to be true is for one of the subexpressions to be true.

(True/False)
4.9/5
(33)

What will be the value of pay after the following statements are executed? int hours = 45; Double pay, payRate = 10.00; Pay = hours <= 40 ? hours * payRate : 40 * payRate + (hours - 40) *payRate * 1.5;

(Multiple Choice)
4.8/5
(37)
Showing 1 - 20 of 58
close modal

Filters

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