Exam 4: Decision Structures
Exam 1: Introduction to Computers and Java40 Questions
Exam 2: Java Fundamentals40 Questions
Exam 3: A First Look at Classes and Objects40 Questions
Exam 4: Decision Structures40 Questions
Exam 5: Loops and Files40 Questions
Exam 6: A Second Look at Classes and Objects40 Questions
Exam 7: Arrays and the ArrayList Class40 Questions
Exam 8: Text Processing and Wrapper Classes40 Questions
Exam 9: Inheritance40 Questions
Exam 10: Exceptions and Advanced File I/O40 Questions
Exam 11: GUI Applications–Part 140 Questions
Exam 12: GUI Applications–Part 240 Questions
Exam 13: Applets and More40 Questions
Exam 14: Creating GUI Applications with JavaFX40 Questions
Exam 15: Recursion20 Questions
Exam 16: Databases40 Questions
Select questions type
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:
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:
True
Enclosing a group of statements inside a set of braces creates
Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
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)
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)
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)
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)
Showing 1 - 20 of 40
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)