Exam 3: Decision Structures
Exam 1: Introduction to Computers and Java51 Questions
Exam 2: Java Fundamentals61 Questions
Exam 3: Decision Structures64 Questions
Exam 4: Loops and Files57 Questions
Exam 5: Methods60 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class64 Questions
Exam 8: A Second Look at Classes and Objects50 Questions
Exam 9: Text Processing and More About Wrapper Classes60 Questions
Exam 10: Inheritance70 Questions
Exam 11: Exceptions and Advanced File IO56 Questions
Exam 12: A First Look at GUI Applications60 Questions
Exam 13: Advanced GUI Applications58 Questions
Exam 14: Applets and More54 Questions
Exam 15: Creating GUI Applications With Javafx and Scene Builder40 Questions
Exam 16: Recursion42 Questions
Exam 17: Databases48 Questions
Select questions type
In an if/else statement, if the boolean expression is False:
(Multiple Choice)
4.7/5
(36)
What will be printed when the following code is executed?
Double x = 45678.259;
System.out.printf("%,.2f", x);
(Multiple Choice)
4.8/5
(36)
What does the following code display?
Double x = 12.3798146;
System.out.printf("%.2f\n", x);
(Multiple Choice)
4.7/5
(45)
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.7/5
(42)
To do a case insensitive compare which of the following could be used to test the equality of two strings, str1 and str2?
(Multiple Choice)
4.8/5
(36)
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.7/5
(44)
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)
4.7/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.9/5
(47)
Which of the following expressions will determine whether x is less than or equal to y?
(Multiple Choice)
4.8/5
(36)
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.8/5
(31)
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
(30)
If str1 and str2 are both Strings, which of the following expressions will correctly determine whether they are equal?
(1)(str1 == str2)
(2) str1.equals(str2)
(3)(str1.compareTo(str2) == 0)
(Multiple Choice)
4.7/5
(36)
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.9/5
(33)
Because the && operator performs short-circuit evaluation, your boolean expression will usually execute faster if the subexpression that is most likely False is on the left of the && operator.
(True/False)
4.8/5
(31)
If chr is a character variable, which of the following if statements is written correctly?
(Multiple Choice)
4.7/5
(35)
An important style rule you should adopt for writing if statements is to write the conditionally executed statement on the line after the if statement.
(True/False)
4.8/5
(37)
Showing 21 - 40 of 64
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)