Question: What is the return type of the String class toUpperCase() method? (3 points) Question 1 options: 1) int 2) double 3) boolean 4) String 5)
What is the return type of the String class toUpperCase() method? (3 points)
Question 1 options:
|
|
| ||
|
|
| ||
|
|
| ||
|
|
| ||
|
|
|
Question 2 (3 points)
Assume the String objects word1 and word2 are initialized as shown below. What is the value of the expression word1.equalsIgnoreCase(word2)? (3 points)
String word1 = "Internet"; String word2 = "internet";
Question 2 options:
|
|
| ||
|
|
| ||
|
|
| ||
|
|
| ||
|
|
|
Question 3 (3 points)
What is the result of the following code segment? (3 points)
String word = "sunflower"; String x = word.substring(3); String y = word.substring(3, 9); if( x == y) System.out.print(1); else if( x.equals(y)) System.out.print(2); else System.out.print(3);
Question 3 options:
|
|
| ||
|
|
| ||
|
|
| ||
|
|
| ||
|
|
|
Question 4 (3 points)
Assume the String objects x and y are initialized as shown below. What is the value of the expression word2.compareTo(word1)? (3 points)
String word1 = "busy"; String word2 = "be";
Question 4 options:
|
|
| ||
|
|
| ||
|
|
| ||
|
|
| ||
|
|
|
Question 5 (3 points)
Which of the following expressions will evaluate to true? (3 points)
I. "Samira".equals("Sami") II. "SAMI".compareTo("Samira") < 0 III. "Sami".compareTo("SAMI") < 0
Question 5 options:
|
|
| ||
|
|
| ||
|
|
| ||
|
|
| ||
|
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
