Deck 7: Characters, Strings and the Stringbuilder

ملء الشاشة (f)
exit full mode
سؤال
String s and other objects that can't be changed are known as ____.

A) string constants
B) accessor methods
C) immutable
D) garbage
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The terms "literal string" and "string literal" have different meanings in Java programming.
سؤال
The method header of the equals() method within the String class is ____.

A) public boolean equals(Strings)
B) private boolean equals(String s)
C) public boolean equals(String s)
D) public boolean equals(Character s)
سؤال
When you compare String s with the == operator, you are comparing their values, not their memory addresses.
سؤال
The methods islowerCase() and toLowerCase() perform the same tasks.
سؤال
When working with String s, it is necessary to explicitly set a String to null .
سؤال
Any string value that is input into a program can be used in arithmetic operations.
سؤال
The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

A) equals()
B) toString()
C) charAt()
D) replace ()
سؤال
A literal string is a(n) ____ object.

A) lost
B) anonymous
C) class
D) named
سؤال
In a compareTo() method, programmers often do not need specific return values but want to determine if a value is positive or negative.
سؤال
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.
سؤال
The Character class ____ from java.lang.Object .

A) calls
B) inherits
C) refers
D) spawns
سؤال
The methods of the Character class that begin with ____ return a character that has been converted to the stated format.

A) is
B) to
C) for
D) in
سؤال
A(n) ____ is a variable that holds a memory address.

A) reference
B) Character
C) buffer
D) immutable
سؤال
A ____ is a class for storing and manipulating changeable data that is composed of multiple characters.

A) Character
B) String
C) StringVariable
D) StringBuilder
سؤال
The StringBuffer class is more efficient than the StringBuilder class because it can execute multiple threads during program execution.
سؤال
If you try to use an index that is greater 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.
سؤال
When you declare a variable of a basic, primitive type, such as int x = 10; , the memory address where x is located holds the ____.

A) location in memory of 10
B) memory address of 10
C) reference to 10
D) value of 10
سؤال
A String variable name is not a simple data type.
سؤال
A(n) ____ comparison is based on the integer Unicode values of the characters.

A) integer
B) symbol
C) lexicographical
D) character
سؤال
A literal string is called a(n) ____.

A) anonymous object
B) String variable
C) empty string
D) wrapper
سؤال
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.

A) programmer-defined
B) instance
C) static
D) immutable
سؤال
The ____ class contains standard methods for testing the values of characters.

A) char
B) character
C) StringChar
D) Character
سؤال
The ____ method returns the length of a String .

A) getSize()
B) getLength()
C) size()
D) length()
سؤال
A StringBuilder object contains a memory block called a _____, which might or might not contain a string.

A) capacity
B) buffer
C) reference
D) thread
سؤال
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.

A) StringBuilder
B) String
C) Integer
D) Convert
سؤال
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.

A) equalsCase()
B) equalsOmitCase()
C) equalsAllCase()
D) equalsIgnoreCase()
سؤال
The ____ method lets you add characters at a specific location within a StringBuilder object.

A) charAt()
B) insert()
C) append()
D) setCharAt()
سؤال
The ____ method takes a String argument and returns its double value.

A) parseString()
B) parseInt()
C) parseDouble()
D) returnDouble()
سؤال
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 ?

A) oneStr.regionMatches(8, twoStr, 8, 3)
B) oneStr.regionMatches(0, twoStr, 0, 7)
C) oneStr.regionMatches(8, twoStr, 0, 3)
D) oneStr.regionMatches(0, twoStr, 8, 3)
سؤال
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.

A) charAt()
B) insert()
C) append()
D) setCharAt()
سؤال
Which of the following correctly declares and initializes a String object?

A) new String = Hello
B) String greeting == "Hello";
C) String greeting = "Hello";
D) String new = "Hello"
سؤال
Assume that aName refers to Roger. What is returned by aName.compareTo("Robert"); 

A) 0
B) positive number
C) negative number
D) false
سؤال
The ____ method allows you to replace all occurrences of some character within a String .

A) substring()
B) toString()
C) replaceCharacter()
D) replace()
سؤال
The ____ method requires an integer argument that indicates the position of the character at that position, starting at 0.

A) charAt()
B) setCharAt()
C) strAt()
D) posChar()
سؤال
The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.

A) 12
B) 16
C) 36
D) 48
سؤال
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.

A) beginsWith()
B) strEnd()
C) endsWith()
D) length()
سؤال
System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join String s.

A) concatenation
B) referencing
C) parsing
D) buffering
سؤال
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.

A) toString()
B) compareTo()
C) equals()
D) equalsIgnoreCase()
سؤال
The ____ method converts any object to a String .

A) convertString()
B) toString()
C) replace()
D) substring()
سؤال
Match between columns
Takes two integer arguments: a start position and an end position
parseDouble().
Takes two integer arguments: a start position and an end position
toLowerCase().
Takes two integer arguments: a start position and an end position
substring().
Takes two integer arguments: a start position and an end position
String variable.
Takes two integer arguments: a start position and an end position
append().
Takes two integer arguments: a start position and an end position
buffer.
Takes two integer arguments: a start position and an end position
setLength()
Takes two integer arguments: a start position and an end position
indexOf()
Takes two integer arguments: a start position and an end position
insert()
Takes two integer arguments: a start position and an end position
anonymous object
Takes two integer arguments: a start position and an end position
immutable
Takes two integer arguments: a start position and an end position
concatenation
Takes two integer arguments: a start position and an end position
wrapper
Takes two integer arguments: a start position and an end position
buffer
Takes two integer arguments: a start position and an end position
capacity
سؤال
Match between columns
Change the length of a string in a StringBuilder object
parseDouble().
Change the length of a string in a StringBuilder object
toLowerCase().
Change the length of a string in a StringBuilder object
substring().
Change the length of a string in a StringBuilder object
String variable.
Change the length of a string in a StringBuilder object
append().
Change the length of a string in a StringBuilder object
buffer.
Change the length of a string in a StringBuilder object
setLength()
Change the length of a string in a StringBuilder object
indexOf()
Change the length of a string in a StringBuilder object
insert()
Change the length of a string in a StringBuilder object
anonymous object
Change the length of a string in a StringBuilder object
immutable
Change the length of a string in a StringBuilder object
concatenation
Change the length of a string in a StringBuilder object
wrapper
Change the length of a string in a StringBuilder object
buffer
Change the length of a string in a StringBuilder object
capacity
سؤال
Match between columns
Length of a buffer
parseDouble().
Length of a buffer
toLowerCase().
Length of a buffer
substring().
Length of a buffer
String variable.
Length of a buffer
append().
Length of a buffer
buffer.
Length of a buffer
setLength()
Length of a buffer
indexOf()
Length of a buffer
insert()
Length of a buffer
anonymous object
Length of a buffer
immutable
Length of a buffer
concatenation
Length of a buffer
wrapper
Length of a buffer
buffer
Length of a buffer
capacity
سؤال
Describe how a programmer would use the two types of Character class methods (those that begin with "is" and those that begin with "to") for testing the values of characters.
سؤال
Match between columns
A memory block
parseDouble().
A memory block
toLowerCase().
A memory block
substring().
A memory block
String variable.
A memory block
append().
A memory block
buffer.
A memory block
setLength()
A memory block
indexOf()
A memory block
insert()
A memory block
anonymous object
A memory block
immutable
A memory block
concatenation
A memory block
wrapper
A memory block
buffer
A memory block
capacity
سؤال
Match between columns
Class or object that wraps around a simpler element
parseDouble().
Class or object that wraps around a simpler element
toLowerCase().
Class or object that wraps around a simpler element
substring().
Class or object that wraps around a simpler element
String variable.
Class or object that wraps around a simpler element
append().
Class or object that wraps around a simpler element
buffer.
Class or object that wraps around a simpler element
setLength()
Class or object that wraps around a simpler element
indexOf()
Class or object that wraps around a simpler element
insert()
Class or object that wraps around a simpler element
anonymous object
Class or object that wraps around a simpler element
immutable
Class or object that wraps around a simpler element
concatenation
Class or object that wraps around a simpler element
wrapper
Class or object that wraps around a simpler element
buffer
Class or object that wraps around a simpler element
capacity
سؤال
Match between columns
A named object of the String class
parseDouble().
A named object of the String class
toLowerCase().
A named object of the String class
substring().
A named object of the String class
String variable.
A named object of the String class
append().
A named object of the String class
buffer.
A named object of the String class
setLength()
A named object of the String class
indexOf()
A named object of the String class
insert()
A named object of the String class
anonymous object
A named object of the String class
immutable
A named object of the String class
concatenation
A named object of the String class
wrapper
A named object of the String class
buffer
A named object of the String class
capacity
سؤال
Match between columns
Add characters at a specific location within a StringBuilder object
parseDouble().
Add characters at a specific location within a StringBuilder object
toLowerCase().
Add characters at a specific location within a StringBuilder object
substring().
Add characters at a specific location within a StringBuilder object
String variable.
Add characters at a specific location within a StringBuilder object
append().
Add characters at a specific location within a StringBuilder object
buffer.
Add characters at a specific location within a StringBuilder object
setLength()
Add characters at a specific location within a StringBuilder object
indexOf()
Add characters at a specific location within a StringBuilder object
insert()
Add characters at a specific location within a StringBuilder object
anonymous object
Add characters at a specific location within a StringBuilder object
immutable
Add characters at a specific location within a StringBuilder object
concatenation
Add characters at a specific location within a StringBuilder object
wrapper
Add characters at a specific location within a StringBuilder object
buffer
Add characters at a specific location within a StringBuilder object
capacity
سؤال
Match between columns
Add characters to the end of a StringBuilder object
parseDouble().
Add characters to the end of a StringBuilder object
toLowerCase().
Add characters to the end of a StringBuilder object
substring().
Add characters to the end of a StringBuilder object
String variable.
Add characters to the end of a StringBuilder object
append().
Add characters to the end of a StringBuilder object
buffer.
Add characters to the end of a StringBuilder object
setLength()
Add characters to the end of a StringBuilder object
indexOf()
Add characters to the end of a StringBuilder object
insert()
Add characters to the end of a StringBuilder object
anonymous object
Add characters to the end of a StringBuilder object
immutable
Add characters to the end of a StringBuilder object
concatenation
Add characters to the end of a StringBuilder object
wrapper
Add characters to the end of a StringBuilder object
buffer
Add characters to the end of a StringBuilder object
capacity
سؤال
Describe how a string is a reference and how a string comparison is done.
سؤال
Match between columns
Object that can't be changed
parseDouble().
Object that can't be changed
toLowerCase().
Object that can't be changed
substring().
Object that can't be changed
String variable.
Object that can't be changed
append().
Object that can't be changed
buffer.
Object that can't be changed
setLength()
Object that can't be changed
indexOf()
Object that can't be changed
insert()
Object that can't be changed
anonymous object
Object that can't be changed
immutable
Object that can't be changed
concatenation
Object that can't be changed
wrapper
Object that can't be changed
buffer
Object that can't be changed
capacity
سؤال
How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.
سؤال
Match between columns
Takes a String argument and returns its double value
parseDouble().
Takes a String argument and returns its double value
toLowerCase().
Takes a String argument and returns its double value
substring().
Takes a String argument and returns its double value
String variable.
Takes a String argument and returns its double value
append().
Takes a String argument and returns its double value
buffer.
Takes a String argument and returns its double value
setLength()
Takes a String argument and returns its double value
indexOf()
Takes a String argument and returns its double value
insert()
Takes a String argument and returns its double value
anonymous object
Takes a String argument and returns its double value
immutable
Takes a String argument and returns its double value
concatenation
Takes a String argument and returns its double value
wrapper
Takes a String argument and returns its double value
buffer
Takes a String argument and returns its double value
capacity
سؤال
Match between columns
Memory block
parseDouble().
Memory block
toLowerCase().
Memory block
substring().
Memory block
String variable.
Memory block
append().
Memory block
buffer.
Memory block
setLength()
Memory block
indexOf()
Memory block
insert()
Memory block
anonymous object
Memory block
immutable
Memory block
concatenation
Memory block
wrapper
Memory block
buffer
Memory block
capacity
سؤال
Explain what is needed to declare a String variable and provide an example.
سؤال
  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?<div style=padding-top: 35px> 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?
سؤال
Match between columns
Determines whether a specific character occurs within a String
parseDouble().
Determines whether a specific character occurs within a String
toLowerCase().
Determines whether a specific character occurs within a String
substring().
Determines whether a specific character occurs within a String
String variable.
Determines whether a specific character occurs within a String
append().
Determines whether a specific character occurs within a String
buffer.
Determines whether a specific character occurs within a String
setLength()
Determines whether a specific character occurs within a String
indexOf()
Determines whether a specific character occurs within a String
insert()
Determines whether a specific character occurs within a String
anonymous object
Determines whether a specific character occurs within a String
immutable
Determines whether a specific character occurs within a String
concatenation
Determines whether a specific character occurs within a String
wrapper
Determines whether a specific character occurs within a String
buffer
Determines whether a specific character occurs within a String
capacity
سؤال
Match between columns
Appending strings
parseDouble().
Appending strings
toLowerCase().
Appending strings
substring().
Appending strings
String variable.
Appending strings
append().
Appending strings
buffer.
Appending strings
setLength()
Appending strings
indexOf()
Appending strings
insert()
Appending strings
anonymous object
Appending strings
immutable
Appending strings
concatenation
Appending strings
wrapper
Appending strings
buffer
Appending strings
capacity
سؤال
Match between columns
An unnamed object
parseDouble().
An unnamed object
toLowerCase().
An unnamed object
substring().
An unnamed object
String variable.
An unnamed object
append().
An unnamed object
buffer.
An unnamed object
setLength()
An unnamed object
indexOf()
An unnamed object
insert()
An unnamed object
anonymous object
An unnamed object
immutable
An unnamed object
concatenation
An unnamed object
wrapper
An unnamed object
buffer
An unnamed object
capacity
سؤال
Match between columns
Returns the lowercase equivalent of the argument
parseDouble().
Returns the lowercase equivalent of the argument
toLowerCase().
Returns the lowercase equivalent of the argument
substring().
Returns the lowercase equivalent of the argument
String variable.
Returns the lowercase equivalent of the argument
append().
Returns the lowercase equivalent of the argument
buffer.
Returns the lowercase equivalent of the argument
setLength()
Returns the lowercase equivalent of the argument
indexOf()
Returns the lowercase equivalent of the argument
insert()
Returns the lowercase equivalent of the argument
anonymous object
Returns the lowercase equivalent of the argument
immutable
Returns the lowercase equivalent of the argument
concatenation
Returns the lowercase equivalent of the argument
wrapper
Returns the lowercase equivalent of the argument
buffer
Returns the lowercase equivalent of the argument
capacity
سؤال
Why would you use the append() method? Provide an example.
سؤال
yourCounty = "Clark"
yourCounty.startsWith("Cla")
What value will be returned by the startsWith() method? Explain how the startsWith() method deals with case sensitivity.
سؤال
How can you change the length of a String in a StringBuilder object?
سؤال
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 .
سؤال
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.
سؤال
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 ?
سؤال
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?
سؤال
StringBuilder greeting = new StringBuilder("Welcome");
Use the append() method to add the characters "home" to the end of the StringBuilder object created above.
سؤال
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.
سؤال
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.
سؤال
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.
سؤال
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 .
سؤال
How can you use String methods to change the case of a string? Provide an example.
سؤال
What is the purpose of the substring() method and how do you use it?
سؤال
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?
سؤال
What is a wrapper and why would you use it?
سؤال
What is the purpose of the replace() method? Provide an example.
سؤال
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?
سؤال
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.
سؤال
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.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/82
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: Characters, Strings and the Stringbuilder
1
String s and other objects that can't be changed are known as ____.

A) string constants
B) accessor methods
C) immutable
D) garbage
C
2
The terms "literal string" and "string literal" have different meanings in Java programming.
False
3
The method header of the equals() method within the String class is ____.

A) public boolean equals(Strings)
B) private boolean equals(String s)
C) public boolean equals(String s)
D) public boolean equals(Character s)
C
4
When you compare String s with the == operator, you are comparing their values, not their memory addresses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
5
The methods islowerCase() and toLowerCase() perform the same tasks.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
6
When working with String s, it is necessary to explicitly set a String to null .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
7
Any string value that is input into a program can be used in arithmetic operations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
8
The String class ____ method evaluates the contents of two String objects to determine if they are equivalent.

A) equals()
B) toString()
C) charAt()
D) replace ()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
9
A literal string is a(n) ____ object.

A) lost
B) anonymous
C) class
D) named
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
10
In a compareTo() method, programmers often do not need specific return values but want to determine if a value is positive or negative.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
11
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
12
The Character class ____ from java.lang.Object .

A) calls
B) inherits
C) refers
D) spawns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
13
The methods of the Character class that begin with ____ return a character that has been converted to the stated format.

A) is
B) to
C) for
D) in
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
14
A(n) ____ is a variable that holds a memory address.

A) reference
B) Character
C) buffer
D) immutable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
15
A ____ is a class for storing and manipulating changeable data that is composed of multiple characters.

A) Character
B) String
C) StringVariable
D) StringBuilder
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
16
The StringBuffer class is more efficient than the StringBuilder class because it can execute multiple threads during program execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you try to use an index that is greater 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
18
When you declare a variable of a basic, primitive type, such as int x = 10; , the memory address where x is located holds the ____.

A) location in memory of 10
B) memory address of 10
C) reference to 10
D) value of 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
19
A String variable name is not a simple data type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
20
A(n) ____ comparison is based on the integer Unicode values of the characters.

A) integer
B) symbol
C) lexicographical
D) character
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
21
A literal string is called a(n) ____.

A) anonymous object
B) String variable
C) empty string
D) wrapper
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
22
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.

A) programmer-defined
B) instance
C) static
D) immutable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
23
The ____ class contains standard methods for testing the values of characters.

A) char
B) character
C) StringChar
D) Character
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
24
The ____ method returns the length of a String .

A) getSize()
B) getLength()
C) size()
D) length()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
25
A StringBuilder object contains a memory block called a _____, which might or might not contain a string.

A) capacity
B) buffer
C) reference
D) thread
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
26
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.

A) StringBuilder
B) String
C) Integer
D) Convert
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
27
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.

A) equalsCase()
B) equalsOmitCase()
C) equalsAllCase()
D) equalsIgnoreCase()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
28
The ____ method lets you add characters at a specific location within a StringBuilder object.

A) charAt()
B) insert()
C) append()
D) setCharAt()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
29
The ____ method takes a String argument and returns its double value.

A) parseString()
B) parseInt()
C) parseDouble()
D) returnDouble()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
30
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 ?

A) oneStr.regionMatches(8, twoStr, 8, 3)
B) oneStr.regionMatches(0, twoStr, 0, 7)
C) oneStr.regionMatches(8, twoStr, 0, 3)
D) oneStr.regionMatches(0, twoStr, 8, 3)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
31
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.

A) charAt()
B) insert()
C) append()
D) setCharAt()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following correctly declares and initializes a String object?

A) new String = Hello
B) String greeting == "Hello";
C) String greeting = "Hello";
D) String new = "Hello"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
33
Assume that aName refers to Roger. What is returned by aName.compareTo("Robert"); 

A) 0
B) positive number
C) negative number
D) false
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
34
The ____ method allows you to replace all occurrences of some character within a String .

A) substring()
B) toString()
C) replaceCharacter()
D) replace()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
35
The ____ method requires an integer argument that indicates the position of the character at that position, starting at 0.

A) charAt()
B) setCharAt()
C) strAt()
D) posChar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
36
The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.

A) 12
B) 16
C) 36
D) 48
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
37
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.

A) beginsWith()
B) strEnd()
C) endsWith()
D) length()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
38
System.out.println("Your name is " + yourName); The above statement is an example of ____, which is used to join String s.

A) concatenation
B) referencing
C) parsing
D) buffering
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
39
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.

A) toString()
B) compareTo()
C) equals()
D) equalsIgnoreCase()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
40
The ____ method converts any object to a String .

A) convertString()
B) toString()
C) replace()
D) substring()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
Takes two integer arguments: a start position and an end position
parseDouble().
Takes two integer arguments: a start position and an end position
toLowerCase().
Takes two integer arguments: a start position and an end position
substring().
Takes two integer arguments: a start position and an end position
String variable.
Takes two integer arguments: a start position and an end position
append().
Takes two integer arguments: a start position and an end position
buffer.
Takes two integer arguments: a start position and an end position
setLength()
Takes two integer arguments: a start position and an end position
indexOf()
Takes two integer arguments: a start position and an end position
insert()
Takes two integer arguments: a start position and an end position
anonymous object
Takes two integer arguments: a start position and an end position
immutable
Takes two integer arguments: a start position and an end position
concatenation
Takes two integer arguments: a start position and an end position
wrapper
Takes two integer arguments: a start position and an end position
buffer
Takes two integer arguments: a start position and an end position
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
42
Match between columns
Change the length of a string in a StringBuilder object
parseDouble().
Change the length of a string in a StringBuilder object
toLowerCase().
Change the length of a string in a StringBuilder object
substring().
Change the length of a string in a StringBuilder object
String variable.
Change the length of a string in a StringBuilder object
append().
Change the length of a string in a StringBuilder object
buffer.
Change the length of a string in a StringBuilder object
setLength()
Change the length of a string in a StringBuilder object
indexOf()
Change the length of a string in a StringBuilder object
insert()
Change the length of a string in a StringBuilder object
anonymous object
Change the length of a string in a StringBuilder object
immutable
Change the length of a string in a StringBuilder object
concatenation
Change the length of a string in a StringBuilder object
wrapper
Change the length of a string in a StringBuilder object
buffer
Change the length of a string in a StringBuilder object
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
43
Match between columns
Length of a buffer
parseDouble().
Length of a buffer
toLowerCase().
Length of a buffer
substring().
Length of a buffer
String variable.
Length of a buffer
append().
Length of a buffer
buffer.
Length of a buffer
setLength()
Length of a buffer
indexOf()
Length of a buffer
insert()
Length of a buffer
anonymous object
Length of a buffer
immutable
Length of a buffer
concatenation
Length of a buffer
wrapper
Length of a buffer
buffer
Length of a buffer
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
44
Describe how a programmer would use the two types of Character class methods (those that begin with "is" and those that begin with "to") for testing the values of characters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match between columns
A memory block
parseDouble().
A memory block
toLowerCase().
A memory block
substring().
A memory block
String variable.
A memory block
append().
A memory block
buffer.
A memory block
setLength()
A memory block
indexOf()
A memory block
insert()
A memory block
anonymous object
A memory block
immutable
A memory block
concatenation
A memory block
wrapper
A memory block
buffer
A memory block
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
46
Match between columns
Class or object that wraps around a simpler element
parseDouble().
Class or object that wraps around a simpler element
toLowerCase().
Class or object that wraps around a simpler element
substring().
Class or object that wraps around a simpler element
String variable.
Class or object that wraps around a simpler element
append().
Class or object that wraps around a simpler element
buffer.
Class or object that wraps around a simpler element
setLength()
Class or object that wraps around a simpler element
indexOf()
Class or object that wraps around a simpler element
insert()
Class or object that wraps around a simpler element
anonymous object
Class or object that wraps around a simpler element
immutable
Class or object that wraps around a simpler element
concatenation
Class or object that wraps around a simpler element
wrapper
Class or object that wraps around a simpler element
buffer
Class or object that wraps around a simpler element
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
47
Match between columns
A named object of the String class
parseDouble().
A named object of the String class
toLowerCase().
A named object of the String class
substring().
A named object of the String class
String variable.
A named object of the String class
append().
A named object of the String class
buffer.
A named object of the String class
setLength()
A named object of the String class
indexOf()
A named object of the String class
insert()
A named object of the String class
anonymous object
A named object of the String class
immutable
A named object of the String class
concatenation
A named object of the String class
wrapper
A named object of the String class
buffer
A named object of the String class
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
Add characters at a specific location within a StringBuilder object
parseDouble().
Add characters at a specific location within a StringBuilder object
toLowerCase().
Add characters at a specific location within a StringBuilder object
substring().
Add characters at a specific location within a StringBuilder object
String variable.
Add characters at a specific location within a StringBuilder object
append().
Add characters at a specific location within a StringBuilder object
buffer.
Add characters at a specific location within a StringBuilder object
setLength()
Add characters at a specific location within a StringBuilder object
indexOf()
Add characters at a specific location within a StringBuilder object
insert()
Add characters at a specific location within a StringBuilder object
anonymous object
Add characters at a specific location within a StringBuilder object
immutable
Add characters at a specific location within a StringBuilder object
concatenation
Add characters at a specific location within a StringBuilder object
wrapper
Add characters at a specific location within a StringBuilder object
buffer
Add characters at a specific location within a StringBuilder object
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match between columns
Add characters to the end of a StringBuilder object
parseDouble().
Add characters to the end of a StringBuilder object
toLowerCase().
Add characters to the end of a StringBuilder object
substring().
Add characters to the end of a StringBuilder object
String variable.
Add characters to the end of a StringBuilder object
append().
Add characters to the end of a StringBuilder object
buffer.
Add characters to the end of a StringBuilder object
setLength()
Add characters to the end of a StringBuilder object
indexOf()
Add characters to the end of a StringBuilder object
insert()
Add characters to the end of a StringBuilder object
anonymous object
Add characters to the end of a StringBuilder object
immutable
Add characters to the end of a StringBuilder object
concatenation
Add characters to the end of a StringBuilder object
wrapper
Add characters to the end of a StringBuilder object
buffer
Add characters to the end of a StringBuilder object
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
50
Describe how a string is a reference and how a string comparison is done.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
51
Match between columns
Object that can't be changed
parseDouble().
Object that can't be changed
toLowerCase().
Object that can't be changed
substring().
Object that can't be changed
String variable.
Object that can't be changed
append().
Object that can't be changed
buffer.
Object that can't be changed
setLength()
Object that can't be changed
indexOf()
Object that can't be changed
insert()
Object that can't be changed
anonymous object
Object that can't be changed
immutable
Object that can't be changed
concatenation
Object that can't be changed
wrapper
Object that can't be changed
buffer
Object that can't be changed
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
52
How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
53
Match between columns
Takes a String argument and returns its double value
parseDouble().
Takes a String argument and returns its double value
toLowerCase().
Takes a String argument and returns its double value
substring().
Takes a String argument and returns its double value
String variable.
Takes a String argument and returns its double value
append().
Takes a String argument and returns its double value
buffer.
Takes a String argument and returns its double value
setLength()
Takes a String argument and returns its double value
indexOf()
Takes a String argument and returns its double value
insert()
Takes a String argument and returns its double value
anonymous object
Takes a String argument and returns its double value
immutable
Takes a String argument and returns its double value
concatenation
Takes a String argument and returns its double value
wrapper
Takes a String argument and returns its double value
buffer
Takes a String argument and returns its double value
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
54
Match between columns
Memory block
parseDouble().
Memory block
toLowerCase().
Memory block
substring().
Memory block
String variable.
Memory block
append().
Memory block
buffer.
Memory block
setLength()
Memory block
indexOf()
Memory block
insert()
Memory block
anonymous object
Memory block
immutable
Memory block
concatenation
Memory block
wrapper
Memory block
buffer
Memory block
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
55
Explain what is needed to declare a String variable and provide an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
56
  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? 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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
57
Match between columns
Determines whether a specific character occurs within a String
parseDouble().
Determines whether a specific character occurs within a String
toLowerCase().
Determines whether a specific character occurs within a String
substring().
Determines whether a specific character occurs within a String
String variable.
Determines whether a specific character occurs within a String
append().
Determines whether a specific character occurs within a String
buffer.
Determines whether a specific character occurs within a String
setLength()
Determines whether a specific character occurs within a String
indexOf()
Determines whether a specific character occurs within a String
insert()
Determines whether a specific character occurs within a String
anonymous object
Determines whether a specific character occurs within a String
immutable
Determines whether a specific character occurs within a String
concatenation
Determines whether a specific character occurs within a String
wrapper
Determines whether a specific character occurs within a String
buffer
Determines whether a specific character occurs within a String
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
58
Match between columns
Appending strings
parseDouble().
Appending strings
toLowerCase().
Appending strings
substring().
Appending strings
String variable.
Appending strings
append().
Appending strings
buffer.
Appending strings
setLength()
Appending strings
indexOf()
Appending strings
insert()
Appending strings
anonymous object
Appending strings
immutable
Appending strings
concatenation
Appending strings
wrapper
Appending strings
buffer
Appending strings
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
59
Match between columns
An unnamed object
parseDouble().
An unnamed object
toLowerCase().
An unnamed object
substring().
An unnamed object
String variable.
An unnamed object
append().
An unnamed object
buffer.
An unnamed object
setLength()
An unnamed object
indexOf()
An unnamed object
insert()
An unnamed object
anonymous object
An unnamed object
immutable
An unnamed object
concatenation
An unnamed object
wrapper
An unnamed object
buffer
An unnamed object
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
60
Match between columns
Returns the lowercase equivalent of the argument
parseDouble().
Returns the lowercase equivalent of the argument
toLowerCase().
Returns the lowercase equivalent of the argument
substring().
Returns the lowercase equivalent of the argument
String variable.
Returns the lowercase equivalent of the argument
append().
Returns the lowercase equivalent of the argument
buffer.
Returns the lowercase equivalent of the argument
setLength()
Returns the lowercase equivalent of the argument
indexOf()
Returns the lowercase equivalent of the argument
insert()
Returns the lowercase equivalent of the argument
anonymous object
Returns the lowercase equivalent of the argument
immutable
Returns the lowercase equivalent of the argument
concatenation
Returns the lowercase equivalent of the argument
wrapper
Returns the lowercase equivalent of the argument
buffer
Returns the lowercase equivalent of the argument
capacity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
61
Why would you use the append() method? Provide an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
62
yourCounty = "Clark"
yourCounty.startsWith("Cla")
What value will be returned by the startsWith() method? Explain how the startsWith() method deals with case sensitivity.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
63
How can you change the length of a String in a StringBuilder object?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
64
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 .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
65
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
66
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 ?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
67
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
68
StringBuilder greeting = new StringBuilder("Welcome");
Use the append() method to add the characters "home" to the end of the StringBuilder object created above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
69
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
70
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
71
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
72
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 .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
73
How can you use String methods to change the case of a string? Provide an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
74
What is the purpose of the substring() method and how do you use it?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
75
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
76
What is a wrapper and why would you use it?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
77
What is the purpose of the replace() method? Provide an example.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
78
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
79
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
80
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 82 في هذه المجموعة.