Exam 4: Decision Structures

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

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

(Multiple Choice)
4.8/5
(33)

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

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

(True/False)
4.9/5
(37)

Which of the following statements will create an object from the Random class?

(Multiple Choice)
4.9/5
(41)

Select all that apply. Which method of the Random class will return a random number within the range of 0.0 and 1.0?

(Multiple Choice)
4.9/5
(37)

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

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

(Multiple Choice)
4.8/5
(36)

A flag may have the values

(Multiple Choice)
4.8/5
(40)

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

(Multiple Choice)
4.8/5
(43)

A random number, created as an object of the Random class, is always an integer.

(True/False)
4.8/5
(39)

Which of the following expressions will determine whether x is less than or equal to y?

(Multiple Choice)
4.7/5
(37)

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

(Multiple Choice)
4.7/5
(31)

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

(True/False)
4.8/5
(38)

Which of the following expressions will generate a random number in the range of 1 through 10?

(Multiple Choice)
4.9/5
(38)

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

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

(Multiple Choice)
4.7/5
(27)

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

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

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

(True/False)
4.9/5
(39)

What will be displayed after the following statements are executed? int hours = 30; Double pay, payRate = 10.00; Pay = hours <= 40 ? hours*payRate : hours*payRate*2.0; System.out.println(pay);

(Multiple Choice)
4.8/5
(45)
Showing 21 - 40 of 42
close modal

Filters

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