Exam 4: Decision Structures

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

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
(40)
Correct Answer:
Verified

C

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.

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

True

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

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

A

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

The boolean expression in an if statement must evaluate to

(Multiple Choice)
4.7/5
(38)

Enclosing a group of statements inside a set of braces creates

(Multiple Choice)
4.7/5
(30)

An important style rule that should be used when writing if statements is to write the conditionally executed statement on the line after the if statement.

(True/False)
4.9/5
(32)

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

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

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

(Multiple Choice)
4.9/5
(35)

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

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

(True/False)
4.7/5
(35)

A block of code is enclosed in a set of

(Multiple Choice)
4.7/5
(45)

What will 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.8/5
(45)

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

(True/False)
4.9/5
(40)

Which of the following strings could be passed to the DecimalFormat constructor to display 12.78 as 12.8%?

(Multiple Choice)
4.9/5
(31)

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

(Multiple Choice)
4.8/5
(41)

What will be the value of discountRate after the following statements are executed? double discountRate = 0.0; Int purchase = 1250; Char cust = 'N'; If (purchase > 1000) If (cust == 'Y') DiscountRate = 0.05; Else DiscountRate = 0.04; Else if (purchase > 750) If (cust == 'Y') DiscountRate = 0.04; Else DiscountRate = 0.03; Else DiscountRate = 0.0;

(Multiple Choice)
4.7/5
(33)

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

(True/False)
4.8/5
(38)

When a character is stored in memory, it is actually the __________ that is stored.

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

Filters

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