Exam 4: Decision Structures

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

What is the value of ans after the following code has been executed? Int x = 40; Int y = 40; Int ans = 0; If (x = y) Ans = x + 10;

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

D

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

Free
(True/False)
4.9/5
(35)
Correct Answer:
Verified

True

Enclosing a group of statements inside a set of braces creates

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

B

________ operators are used to determine whether a specific relationship exists between two values.

(Multiple Choice)
4.9/5
(34)

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
(36)

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

(True/False)
4.8/5
(42)

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

(Multiple Choice)
4.8/5
(30)

What would be the value of discountRate after the following statements are executed? Double discountRate = 0.0; Int purchase = 100; If (purchase > 1000) DiscountRate = 0.05; Else if (purchase > 750) DiscountRate = 0.03; Else if (purchase > 500) DiscountRate = 0.01;

(Multiple Choice)
4.9/5
(34)

The boolean expression in an if statement must evaluate to

(Multiple Choice)
4.8/5
(34)

What would 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)
5.0/5
(28)

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

(Multiple Choice)
4.8/5
(43)

Java requires that the boolean expression being tested by an if statement be enclosed in

(Multiple Choice)
4.9/5
(29)

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

(Multiple Choice)
4.8/5
(34)

Which of the following statements determines whether temp is within the range of 0 through 100?

(Multiple Choice)
4.8/5
(33)

A flag may have the values

(Multiple Choice)
4.7/5
(37)

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

What will be the value of x after the following code is executed? Int x = 75; Int y = 60; If (x > y) X = x - y;

(Multiple Choice)
4.7/5
(31)

What will be the value of bonus after the following code is 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.7/5
(31)

The DecimalFormat class is part of the Java API, but it is not automatically available to your programs.

(True/False)
4.8/5
(39)

A block of code is enclosed in a set of

(Multiple Choice)
4.8/5
(34)
Showing 1 - 20 of 40
close modal

Filters

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