Exam 14: Strings

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

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?

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

D

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

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

D

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

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

C

Which of the following creates the string of the numbers from 1 to 1000 most efficiently?

(Multiple Choice)
4.9/5
(31)

The length of a string can be determined by ________.

(Multiple Choice)
4.9/5
(41)

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
(39)

Which of the following statements is true?

(Multiple Choice)
4.8/5
(28)

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

(Multiple Choice)
5.0/5
(33)

Which class is not a type-wrapper class?

(Multiple Choice)
4.7/5
(42)

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
(31)

Which of the following are static Character methods?

(Multiple Choice)
4.9/5
(32)

Consider the Java segment: String line1 = new String("c = 1 + 2 + 3"); StringTokenizer tok = new StringTokenizer(line1); Int count = tok.countTokens(); The value of count is ________.

(Multiple Choice)
4.9/5
(32)

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:

(Multiple Choice)
5.0/5
(37)

The String method substring returns ________.

(Multiple Choice)
5.0/5
(34)

How many String objects are instantiated by the following code segment (not including the literals)? String s1,output; S1 = "hello"; Output = "\nThe string reversed is: " ; For (int i = s1.length()- 1;i >= 0;i--) Output += s1.charAt(i)+ " " ;

(Multiple Choice)
4.9/5
(34)

Which of the following will create a String different from the other three?

(Multiple Choice)
4.9/5
(27)

Which of the following statements is true?

(Multiple Choice)
4.9/5
(37)

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

(Multiple Choice)
4.8/5
(35)

String objects are immutable.This means they ________.

(Multiple Choice)
4.7/5
(32)

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

(Multiple Choice)
4.8/5
(34)
Showing 1 - 20 of 27
close modal

Filters

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