Exam 7: Characters Strings and the Stringbuilder
Exam 1: Creating Java Programs61 Questions
Exam 2: Using Data67 Questions
Exam 3: Using Methods Classes and Objects66 Questions
Exam 4: More Object Concepts66 Questions
Exam 5: Making Decisions66 Questions
Exam 6: Looping66 Questions
Exam 7: Characters Strings and the Stringbuilder68 Questions
Exam 8: Arrays66 Questions
Exam 9: Advanced Array Concepts66 Questions
Exam 10: Introduction to Inheritance66 Questions
Exam 11: Advanced Inheritance Concepts66 Questions
Exam 12: Exception Handling66 Questions
Exam 13: File Input and Output66 Questions
Exam 14: Introduction to Swing Components66 Questions
Exam 15: Advanced Gui Topics66 Questions
Exam 16: Graphics66 Questions
Select questions type
What happens when you increase a StringBuilder object's length to be longer than the string it holds? What happens if you set the length of a string to be shorter than the string it contains?
(Essay)
4.8/5
(35)
The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.
(Multiple Choice)
4.9/5
(32)
In Java, a(n) ____________________ is a class or object that is wrapped around a simpler element.
(Short Answer)
4.9/5
(39)
The ____ method takes a String argument and returns its double value.
(Multiple Choice)
4.8/5
(27)
yourCounty = "perry";
yourCounty.equals("Perry");
yourCounty.equalsIgnoreCase("Perry");
Using the above statements, what value will be returned by the equals() method? What will be the value of the equalsIgnoreCase() method? Explain how the equalsIgnoreCase() method can be useful when users type responses to prompts in programs.
(Essay)
4.8/5
(40)
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.7/5
(45)
When using the prewritten equals() method, a true or false comparison between two String s is returned, but you do not know how the code looks behind the scenes.
(True/False)
4.9/5
(41)
The ____ method allows you to replace all occurrences of some character within a String .
(Multiple Choice)
4.9/5
(38)
Besides Double and Integer , other wrapper classes such as Float and Long also provide ____ methods that convert String s to the wrapper types.
(Multiple Choice)
4.9/5
(28)
To convert a String to an integer, you use the ____ class, which is part of java.lang and is automatically imported into programs you write.
(Multiple Choice)
4.8/5
(32)
StringBuilder greeting = new StringBuilder("Welcome home ");
phrase.insert(13, "Joe");
Using the above code and insert() method, describe how the phrase will appear after the code executes. How does the insert() method work?
(Essay)
4.8/5
(46)
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.9/5
(37)
The ____________________ class contains standard methods for testing the values of characters.
(Short Answer)
4.8/5
(38)
Describe how a string is a reference and how a string comparison is done.
(Essay)
4.9/5
(44)
String aName = "Michael"
Using the above statement, write the length() method that will return the length of the aName String . What value will the length() method return when executed?
(Essay)
5.0/5
(31)
Showing 21 - 40 of 68
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)