COSC 1437 CH4
If the expression on the left side of the && operator is false, the expression on the right side will not be checked.
True
The ________ statement is used to create a decision structure, which allows a program to have more than one path of execution.
if
Which of the following statements determines whether temp is within the range of 0 through 100?
if (temp >= 0 && temp <= 100)
If str1 and str2 are both String objects, which of the following expressions will correctly determine whether or not they are equal?
str1.equals(str2)
In an if-else statement, if the boolean expression is false
the statement or block following the else is executed.
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
The DecimalFormat class is part of the Java API, but it is not automatically available to your programs.
True
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.
False
When two strings are compared using the String class's compareTo method, the comparison is case-insensitive.
False
What will be the values of ans, x, and y after the following statements are executed?
ans=60 x=0 y=50
What would be the value of discountRate after the following statements are executed? swith discountrate=0.0
0.0
What would be the value of x after the following statements were executed? int x=10 switchx
20
What is the value of ans after the following code has been executed? x=40 y=40 ans=0 ifx=y ans=x+10
The code contains an error and will not compile.
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);
The code contains an error and will not compile.
Unicode is an international encoding system that is extensive enough to represent all the characters of all the world's alphabets.
True