Exam 14: Strings, Characters and Regular Expressions

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

Given the following declaration: StringBuilder buf = new StringBuilder(); What is the capacity of buf?

Free
(Multiple Choice)
4.9/5
(92)
Correct Answer:
Verified

C

Given the following declarations: StringBuilder buf; StringBuilder buf2 = new StringBuilder(); String c = new String("test"); Which of the following is not a valid StringBuilder constructor?

Free
(Multiple Choice)
4.9/5
(88)
Correct Answer:
Verified

B

Consider the Java segment: String line1 = new String("c = 1 + 2 + 3") ; StringTokenizer tok = new StringTokenizer(line1, delimArg); For the String line1 to have 4 tokens, delimArg should be:

Free
(Multiple Choice)
4.7/5
(84)
Correct Answer:
Verified

A

Which of the following statements is true?

(Multiple Choice)
4.9/5
(87)

Which of the following are static Character methods?

(Multiple Choice)
5.0/5
(85)

Consider the examples below: A. a string. B. 'a string'. C. "a string". D. "1234". E. integer. Which could be the value of a Java variable of type String?

(Multiple Choice)
4.9/5
(81)

The statement s1.startsWith("art") Has the same result as which of the following?

(Multiple Choice)
4.8/5
(79)

The length of a string can be determined by ________.

(Multiple Choice)
4.7/5
(92)

A String constructor cannot be passed ________.

(Multiple Choice)
4.8/5
(87)

The statement s1.equalsIgnoreCase(s4) Is equivalent to which of the following?

(Multiple Choice)
4.9/5
(79)

Consider the statement below: StringBuilder sb1 = new StringBuilder("a toyota"); Which of the following creates a String object with the value "toy"?

(Multiple Choice)
4.8/5
(80)

Which class is not a type-wrapper class?

(Multiple Choice)
4.8/5
(82)

Consider the statements below: StringBuilder sb = new StringBuilder("a toyota"); Sb)insert(2, "landrover"); Sb)delete(11, 16); Sb)insert(11, " "); The StringBuilder contents at the end of this segment will be ________.

(Multiple Choice)
4.9/5
(82)

An anonymous String ________.

(Multiple Choice)
4.8/5
(66)

Consider the Java segment: String line1 = new String("c = 1 + 2 + 3") ; StringTokenizer tok = new StringTokenizer(line1, "+="); String foo = tok.nextToken(); String bar = tok.nextToken(); The values of foo and bar are:

(Multiple Choice)
4.8/5
(79)

To find the character at a certain index position within a String, use the method ________.

(Multiple Choice)
4.8/5
(69)

StringBuilder objects can be used in place of String objects if ________.

(Multiple Choice)
4.9/5
(83)

Given the following declarations: StringBuilder buffer = new StringBuilder("Testing Testing"); Buffer.setLength(7); Buffer.ensureCapacity(5); Which of the following is true?

(Multiple Choice)
4.9/5
(96)

Which of the following is not a method of class String?

(Multiple Choice)
4.7/5
(79)

Which of the following statements is true?

(Multiple Choice)
4.8/5
(75)
Showing 1 - 20 of 26
close modal

Filters

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