Exam 3: Decision Structures

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

What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x);

(Multiple Choice)
4.9/5
(35)

Which of the following expressions could be used to perform a case-insensitive comparison of two String objects named str1 and str2?

(Multiple Choice)
4.7/5
(41)

The if-else statement will execute one group of statements if its boolean expression is true or another group if its boolean expression is false.

(True/False)
4.8/5
(38)

Which of the following expressions determines whether the char variable, chrA, is not equal to the letter 'A'?

(Multiple Choice)
4.9/5
(32)

What will be displayed after the following statements are executed? int ans = 10; Int x = 65; Int y = 55; If (x >= y) { Int ans = x + y; } System.out.println(ans);

(Multiple Choice)
4.9/5
(46)

What will be the value of ans after the following statements are executed? int x = 40; Int y = 40; If (x = y) Ans = x + 10;

(Multiple Choice)
4.9/5
(31)

A flag may have the values

(Multiple Choice)
4.9/5
(39)

If the expression on the left side of the && operator is false, the expression on the right side will not be checked.

(True/False)
4.9/5
(30)

Which of the following is the not equal operator?

(Multiple Choice)
4.8/5
(35)

What would be the value of bonus after the following statements are executed? int bonus, sales = 85000; Char dept = 'S'; If (sales > 100000) If (dept == 'R') Bonus = 2000; Else Bonus = 1500; Else if (sales > 75000) If (dept == 'R') Bonus = 1250; Else Bonus = 1000; Else Bonus = 0;

(Multiple Choice)
4.9/5
(35)

When two strings are compared using the String class's compareTo method, the comparison is not case sensitive.

(True/False)
4.8/5
(35)

An expression tested by an if statement must evaluate to

(Multiple Choice)
4.9/5
(36)

What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y = 50; If (x >= y) { Ans = x + 10; X -= y; } Else { Ans = y + 10; Y += x; }

(Multiple Choice)
4.8/5
(42)

What will be the value of bonus after the following statements are executed? int bonus, sales = 10000; If (sales < 5000) Bonus = 200; Else if (sales < 7500) Bonus = 500; Else if (sales < 10000) Bonus = 750; Else if (sales < 20000) Bonus = 1000; Else Bonus = 1250;

(Multiple Choice)
4.8/5
(40)

What will be the value of x after the following statements are executed? int x = 10; Switch (x) { Case 10: X += 15; Case 12: X -= 5; Break; Default: X *= 3; }

(Multiple Choice)
4.8/5
(46)

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

(True/False)
4.9/5
(34)

________ works like this: If the expression on the left side of the && operator is false, the expression the right side will not be checked.

(Multiple Choice)
5.0/5
(43)

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
(31)
Showing 41 - 58 of 58
close modal

Filters

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