The StringBuilder constructor used in the following statement will
StringBuilder str = new StringBuilder(25);
~~~Give the object, str, 25 bytes of storage and not store anything in them
What will be the value of str after the following statements are executed?
StringBuilder str =
new StringBuilder("We have lived in Chicago, " +
"Trenton, and Atlanta.");
str.replace(17, 24, "Tampa");
~~~~We have lived in Tampa, Trenton, and Atlanta.
What will be the tokens in the following statement?
StringTokenizer strToken = new StringTokenizer("123-456-7890",
"-", true);
~~~123, 456, 7890, and -
If you do not specify delimiters in the StringTokenconstructor, which of the following cannot be a delimiter?
~~~Semicolon
What will be the tokens in the following statement?
String str = "red$green&blue#orange";
String tokens = str.split("[$&#]");
~~~"red", "green", "blue"and "orange"
If a string has more than one character used as a delimiter, we must write a loop to determine the tokens, one for each delimiter character.
~~false
What is the value of str after the following code has been executed?
String str;
String sourceStr = "Hey diddle, diddle, the cat and the fiddle";
str = sourceStr.substring(12,17);
~~~diddl
StringBuilder objects are not immutable.
~~true
What will be the value of matches after the following code has been executed?
boolean matches;
String str1 = "The cow jumped over the moon.";
String str2 = "moon";
matches = str1.endsWith(str2);
~~~false
If str is declared as
String str = "ABCDEFGHI";
what will be returned fromCharacter.toLowerCase(str.charAt(5))?
~~f
The String class’s valueOf() method accepts a string representation as an argument and returns its equivalent integer value.
~~False
What will be the value of loc after the following code is executed?
int loc;
String str = "The cow jumped over the moon.";
loc = str.lastIndexOf("ov", 14);
~~-1
What does the following statement do?
Float number = new Float(8.8);
~~All of the above
To convert the string, str = "285" to an int, use the following statement
~~int x = Integer.parseInt(str);
What will be the value of loc after the following code is executed?
int loc;
String str = "The cow jumped over the moon.";
loc = str.indexOf("ov");
~~. 15
The following statement correctly creates aStringBuilder object.
StringBuilder str = "Caesar Salad";
~~false
What would be the results of executing the following code?
StringBuilder str = new StringBuilder(12);
str.append("The cow");
str.append(" jumped over the ");
str.append("moon.");
~~strbuff would equal "The cow jumped over the moon."
Two ways of concatenating two Strings are
~~Use the concat() method or use the + between the two Strings
The following statement correctly creates aStringBuilder object.
StringBuilder str = "Caesar Salad";
==false
If a string has more than one character used as a delimiter, we must write a loop to determine the tokens, one for each delimiter character.
==flase
What will be printed after the following code is executed?
String str = "abc456";
int m = 0;
while ( m < 6 )
{
if (!Character.isLetter(str.charAt(m)))
System.out.print(
Character.toUpperCase(str.charAt(m)));
m++;
}
==456
Which of the following statements will print the maximum value a double variable may have?
==System.out.println(Double.MAX_VALUE);
To convert the int variable, number to a string, use the following statement.
==String str = Integer.toString(number);
The no-arg constructor for a StringBuilder object gives the object enough storage space to hold this many characters.
=16 characters
Stainless Steel - Tiaglass Art
ReplyDeleteStainless Steel is the best stainless steel you will ever babylisspro nano titanium hair dryer buy. You get this 2018 ford fusion hybrid titanium stainless steel in price of titanium two pieces and it is made of stainless steel. All stainless steel titanium bikes in damascus titanium one box has a Rating: 4.4 · 5 reviews