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
The methods islowerCase() and toLowerCase() perform the same tasks.
Free
(True/False)
4.8/5
(34)
Correct Answer:
False
StringBuilder greeting = new StringBuilder("Day 1");
Using the above StringBuilder , create a setCharAt() method that will change the "1" to a "2" in the String "Day 1" . Explain how the setCharAt() method operates.
Free
(Essay)
4.8/5
(34)
Correct Answer:
greeting.setCharAt(4, '2'); To alter just one character in a StringBuilder , you can use the setCharAt() method, which allows you to change a character at a specified position within a StringBuilder object. This method requires two arguments: an integer position and a character. In the phrase "Day 1", the greeting.setCharAt(4, '2'); changes the value 1 to 2.
Match each term with the correct statement below.
Premises:
Change the length of a string in a StringBuilder object
Responses:
substring().
append().
anonymous object
Correct Answer:
Premises:
Responses:
Free
(Matching)
4.8/5
(38)
Correct Answer:
Match each term with the correct statement below.
Premises:
Class or object that wraps around a simpler element
Responses:
insert()
immutable
concatenation
Correct Answer:
Premises:
Responses:
(Matching)
4.9/5
(35)
The method header of the equals() method within the String class is ____.
(Multiple Choice)
4.9/5
(28)
When you declare a variable of a basic, primitive type, such as int x = 10; , the memory address where x is located holds the ____.
(Multiple Choice)
4.7/5
(42)
The ____ class contains standard methods for testing the values of characters.
(Multiple Choice)
4.8/5
(34)
The ____ method takes a String argument and returns its double value.
(Multiple Choice)
4.9/5
(39)
Describe how a string is a reference and how a string comparison is done.
(Essay)
4.8/5
(33)
Consider the statement: int anInt = Integer.parseInt("649");
You can tell that parseInt() is a(n) ____ method because you use it with the class name and not with an object.
(Multiple Choice)
4.9/5
(37)
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.9/5
(29)
A(n) ____ comparison is based on the integer Unicode values of the characters.
(Multiple Choice)
4.9/5
(28)
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.9/5
(43)
When you must determine whether a String is empty, it is more efficient to compare its length to 0 than it is to use the equals () method.
(True/False)
4.8/5
(43)
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.7/5
(38)
StringBuilder greeting = new StringBuilder("Welcome");
Use the append() method to add the characters "home" to the end of the StringBuilder object created above.
(Essay)
4.8/5
(39)
String oneStr = "Welcome Jim" String twoStr = "Welcome Joe"
Given the lines of code above, which of the following regionMatches() expressions will result in a value of true ?
(Multiple Choice)
4.7/5
(43)
Showing 1 - 20 of 82
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)