Exam 7: Characters Strings and the Stringbuilder

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

StringBuilder greeting = new StringBuilder("Hello, John"); char initial = greeting.charAt(7); Using the above code and the charAt() method, what value will be assigned to the variable initial ?

(Essay)
4.9/5
(91)

String greeting = "Welcome Home"; Using the above String , create the String method to convert the greeting String to all uppercase. Likewise, create the String method to convert the greeting String to all lowercase.

(Essay)
4.8/5
(78)

String firstString = "Oak Maple Pine" String secondString = "spruce Maple elm" firstCompare.regionMatches(4, secondString, 7, 5) Using the above code, what will be the Boolean value after execution of the regionMatches statement? Explain how the String s are compared using the regionMatches() method.

(Essay)
4.9/5
(88)

yourCounty = "Clark" yourCounty.startsWith("Cla") What value will be returned by the startsWith() method? Explain how the startsWith() method deals with case sensitivity.

(Essay)
4.8/5
(89)

String greeting = "Welcome back"; Using the above statement, write the length() method that will return the length of the greeting String . Store the length in an integer named greetingLength .

(Short Answer)
5.0/5
(81)

The ____________________ method and the startsWith() method each take a String argument and return true or false if a String object does or does not end or start with the specified argument, respectively.

(Short Answer)
4.8/5
(69)

The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

(Multiple Choice)
4.9/5
(64)

myCounty = "Clark Jackson Scioto" myCounty.charAt(6) Using the above code, what will be the value of the charAt() method once the code executes? Explain how the charAt() method operates.

(Essay)
4.9/5
(74)

To alter just one character in a StringBuilder , you can use the ____ method, which allows you to change a character at a specified position within a StringBuilder object.

(Multiple Choice)
4.9/5
(80)

How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.

(Essay)
4.8/5
(75)

String s and other objects that can't be changed are known as ____.

(Multiple Choice)
4.9/5
(99)

When you compare String s with the == operator, you are comparing their values, not their memory addresses.

(True/False)
4.8/5
(75)
Match each term with the correct statement below.
Change the length of a string in a StringBuilder object
parseDouble()
Takes two integer arguments: a start position and an end position
buffer
Add characters to the end of a StringBuilder object
String variable
Correct Answer:
Verified
Premises:
Responses:
Change the length of a string in a StringBuilder object
parseDouble()
Takes two integer arguments: a start position and an end position
buffer
Add characters to the end of a StringBuilder object
String variable
Takes a String argument and returns its double value
append()
A memory block
substring()
Returns the lowercase equivalent of the argument
toLowerCase()
A named object of the String class
insert()
Determines whether a specific character occurs within a String
setLength()
Add characters at a specific location within a StringBuilder object
indexOf()
(Matching)
4.9/5
(73)

System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join String s.

(Multiple Choice)
4.9/5
(82)

The ____ method converts any object to a String .

(Multiple Choice)
4.7/5
(71)

The terms "literal string" and "string literal" are entirely different in Java programming.

(True/False)
4.9/5
(80)

The methods of the Character class that begin with ____ return a character that has been converted to the stated format.

(Multiple Choice)
4.9/5
(82)

Why would you use the append() method? Provide an example.

(Essay)
4.9/5
(79)

What is a wrapper and why would you use it?

(Essay)
4.9/5
(84)

How can you use String methods to change the case of a string? Provide an example.

(Essay)
4.8/5
(79)
Showing 41 - 60 of 68
close modal

Filters

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