Exam 7: Characters, Strings and the Stringbuilder
Exam 1: Creating Your First Java Classes76 Questions
Exam 2: Using Data81 Questions
Exam 3: Using Methods, Classes and Objects79 Questions
Exam 4: More Object Concepts84 Questions
Exam 5: Making Decisions80 Questions
Exam 6: Looping77 Questions
Exam 7: Characters, Strings and the Stringbuilder82 Questions
Exam 8: Arrays77 Questions
Exam 9: Advanced Array Concepts80 Questions
Exam 10: Introduction to Inheritance78 Questions
Exam 11: Advanced Inheritance Concepts78 Questions
Exam 12: Exception Handling79 Questions
Exam 13: File Input and Output78 Questions
Exam 14: Introduction to Swing Components79 Questions
Exam 15: Using Javafx and Scene Builder65 Questions
Select questions type
Give a code example of using the equivalence operator ("==") to compare the addresses of two strings where the comparison will result in the value true . The example should produce output indicating the strings have the same value.
(Essay)
4.8/5
(43)
The ____ method lets you add characters at a specific location within a StringBuilder object.
(Multiple Choice)
4.8/5
(38)
Match each term with the correct statement below.
Premises:
Length of a buffer
Responses:
insert()
buffer.
String variable.
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(36)
How can you use String methods to change the case of a string? Provide an example.
(Essay)
4.7/5
(37)
A StringBuilder object contains a memory block called a _____, which might or might not contain a string.
(Multiple Choice)
4.8/5
(43)
String example1 = "";
String example2 = null;
String example3;
There is an important difference between empty String s and null String s. Explain the differences and why it is important when making String comparisons.
(Essay)
4.9/5
(36)
Any string value that is input into a program can be used in arithmetic operations.
(True/False)
4.8/5
(41)
When you compare String s with the == operator, you are comparing their values, not their memory addresses.
(True/False)
4.8/5
(42)
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.
(Multiple Choice)
5.0/5
(34)
The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.
(Multiple Choice)
4.8/5
(37)
The ____ method allows you to replace all occurrences of some character within a String .
(Multiple Choice)
4.8/5
(35)
Match each term with the correct statement below.
Premises:
A memory block
Responses:
String variable.
concatenation
anonymous object
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(44)
import javax.swing.JOptionPane;
public class Practice
{
public static void main(String[] args)
{
String fullName;
char firstLetter;
____
____
}
}
Accepting a String from a user is common practice. Using the above code, write the statements to accept a String response from a user. Prompt the user with "Enter your name". Then use the charAt() method to extract the first character of the String .
(Essay)
4.7/5
(35)
The String class ____ method is similar to the equals() method. As its name implies, this method does not consider case when determining if two String s are equivalent.
(Multiple Choice)
4.9/5
(41)
Match each term with the correct statement below.
Premises:
Appending strings
Responses:
concatenation
setLength()
String variable.
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(40)
Match each term with the correct statement below.
Premises:
Takes two integer arguments: a start position and an end position
Responses:
anonymous object
String variable.
immutable
Correct Answer:
Premises:
Responses:
(Matching)
4.8/5
(34)
When the String class ____ method is used to compare two String s, it provides additional information to the user in the form of an integer value.
(Multiple Choice)
4.8/5
(43)
How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.
(Essay)
4.9/5
(37)
In the above code, two strings are evaluated using the equivalency operator. Why can this be a problem, and what other methods are offered by Java for working with characters and strings?

(Essay)
4.7/5
(45)
Showing 41 - 60 of 82
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)