Exam 9: Text Processing and More About Wrapper Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The __________ class is the wrapper class for the char data type.

Free
(Multiple Choice)
4.8/5
(32)
Correct Answer:
Verified

C

If a string has more than one character used as a delimiter, you must write a loop to determine the tokens, one for each delimiter character.

Free
(True/False)
4.8/5
(40)
Correct Answer:
Verified

False

What will be the value of position after the following code is executed? int position; String str = "The cow jumped over the moon."; Position = str.lastIndexOf("ov", 14);

Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
Verified

D

In the following code, how many times will the for loop execute? String str = "1,2,3,4,5,6,7,8,9"); String[ ] tokens = str.split(","); For (String s : tokens) System.out.println(s);

(Multiple Choice)
4.8/5
(43)

What will be displayed after the following code is executed? boolean matches; String str1 = "The cow jumped over the moon."; String str2 = "moon"; Matches = str1.endsWith(str1); System.out.println(matches);

(Multiple Choice)
4.9/5
(39)

Most of the String comparison methods are case sensitive.

(True/False)
4.9/5
(30)

What will be displayed after the following code is executed? String str = "RSTUVWXYZ"; System.out.println(str.charAt(5));

(Multiple Choice)
4.9/5
(36)

What will be displayed after the following code is executed? StringBuilder strb = new StringBuilder(12); Strb.append("The cow "); Strb.append("jumped over the "); Strb.append("moon."); System.out.println(strb);

(Multiple Choice)
4.9/5
(28)

Autoboxing is __________.

(Multiple Choice)
4.9/5
(34)

Any ___________ argument passed to the Character class's toLowerCase method or toUpperCase method is returned as it is.

(Multiple Choice)
4.8/5
(42)

What will be displayed after the following statements are executed? String str = "red$green&blue#orange"; String[ ] tokens = str.split("[$&#]"); For (String s : tokens) System.out.print(s + " ");

(Multiple Choice)
4.8/5
(32)

If you are using characters other than whitespaces as delimiters, you will probably want to trim the string before tokenizing; otherwise, the leading and/or following whitespaces will become part of the first and/or last token.

(True/False)
4.8/5
(41)

The wrapper classes in Java are immutable, which means that once you create an object, you cannot change the object's value.

(True/False)
4.9/5
(41)

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++; }

(Multiple Choice)
4.9/5
(40)

What will be the value of matches after the following code is executed? boolean matches; String[ ] productCodes = {"456HI345", "3456hj"}; Matches = productCodes[0].regionMatches(true, 1, ProductCodes[1], 2, 3);

(Multiple Choice)
4.8/5
(27)

You can change the contents of a StringBuilder object, but you cannot change the contents of a String object.

(True/False)
4.7/5
(40)

When working with the String and StringBuilder classes' getChars method, the character at the start position is included in the substring but the character at the end position is not included.

(True/False)
4.9/5
(35)

If a non-letter argument is passed to the toLowerCase or toUpperCase method, the boolean value false is returned.

(True/False)
4.9/5
(30)

Which of the following import statements is required to use the Character wrapper class?

(Multiple Choice)
4.7/5
(40)

Which of the following statements will convert the string, str = "285.74" to a double?

(Multiple Choice)
4.9/5
(25)
Showing 1 - 20 of 62
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)