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
StringBuilder greeting = new StringBuilder("Welcome");
Use the append() method to add the characters "home" to the end of the StringBuilder object created above.
Free
(Essay)
5.0/5
(44)
Correct Answer:
greeting.append(" home");
(Be sure that the String in double quotes has a blank space at the start. Otherwise, the String s "Welcome" and "home" will be appended without a blank space.)
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 ?
Free
(Multiple Choice)
4.7/5
(36)
Correct Answer:
B
The ____________________ method requires an integer argument that indicates the position of the character at that position, starting at 0.
Free
(Short Answer)
4.9/5
(40)
Correct Answer:
charAt()
Any string value that is input into a program can be used in arithmetic operations.
(True/False)
4.7/5
(35)
The ____ method lets you add characters at a specific location within a StringBuilder object.
(Multiple Choice)
4.8/5
(41)
Explain what is needed to declare a String variable and provide an example.
(Essay)
4.9/5
(29)
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
(39)
When working with String s, it is necessary to explicitly set a String to null .
(True/False)
4.8/5
(31)
String s and other objects that can't be changed are said to be immutable. What does this mean and how does it relate to values held in memory addresses?
(Essay)
4.8/5
(33)
In a compareTo() method, programmers often do not need specific return values but want to determine if a value is positive or negative.
(True/False)
4.9/5
(28)
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.7/5
(30)
A ____ is a class for storing and manipulating changeable data that is composed of multiple characters.
(Multiple Choice)
4.8/5
(34)
You can tell that the equals() method takes a ____ argument because parentheses are used in the method call.
(Multiple Choice)
4.9/5
(34)
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
(26)
A(n) ____ comparison is based on the integer Unicode values of the characters.
(Multiple Choice)
4.7/5
(38)
If you try to use an index that is less than 0 or less than the index of the last position in the StringBuilder object, you cause an error known as an exception and your program terminates.
(True/False)
4.7/5
(41)
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.9/5
(43)
Showing 1 - 20 of 68
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)